The example on this Handbook page http://drupal.org/node/342132 (Get the result a view creates) looks like a good one for the API section of Views documentation.

Suggest adding it to the Advanced Help inside Views, and then archiving the Handbook page when this has been done.

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new1.81 KB

Why not even bring this into the views module? I guess its often used

merlinofchaos’s picture

Title: Programming addition to Views help » Archive this handbook page: Programming addition to Views help
Project: Views (for Drupal 7) » Documentation
Version: 6.x-2.x-dev »
Component: Documentation » Outdated
Category: feature » task
Status: Needs review » Active

Ok, committed to Views and moved to Documentation queue to handle archiving or editing the old documentation. It may still be valuable as an example of how to manipulate a view even with that function available in Views.

jhodgdon’s picture

Status: Active » Fixed

Thanks. The old doc page has been archived.

bricel’s picture

Project: Documentation » Views (for Drupal 7)
Version: » 6.x-2.x-dev
Component: Outdated » Code
Status: Fixed » Needs review
StatusFileSize
new2.16 KB

I've modified the patch to improve DX :
- Changed the function signature to include args = array() .
- Removed some unneeded code fetching arguments.
- Fixed the documentation to comply with Drupal standards.

merlinofchaos’s picture

Note that changing $args to an array makes the signature differ from views_embed_view() -- I'm not sure that's a good thing.

dawehner’s picture

Yes thats exactly what i thought.

views_embed_view('view', 'default', 1, 'type');
views_embed_view('view', 'default', array(1, 'type'));

Decide which is more friendly for the developer :) i think the first one.

jhodgdon’s picture

Title: Archive this handbook page: Programming addition to Views help » Programming addition to Views help
amitaibu’s picture

@dereine,

I think the 2nd option (with the array) is better DX. Just by looking at the function's signature one can know $args can be passed. Currently, they should look into the code and see the func_get_args(), and understand from that they can pass args.

merlinofchaos’s picture

Regardless, consistency with an existing very similar function matters, even if one format may be marginally better. The consistency is more important, and Views is already inconsistent enough, thankyouverymuch =)

amitaibu’s picture

Status: Needs review » Closed (won't fix)

Ok, I agree that consistency wins in this case, so "won't fix".