I find that I very rarely use the $title parameter, but it is 2nd and must be either '' or FALSE. However the display id is more of a required and less optional (although it will default).

I suggest
1) Make $display_id the 2nd parameter, defaulting it to 'default' (or keeping 'block_1')
2) Changing title to be provided in an $options array as an optional 3rd parameter.

The change will make the following:

  // Currently
  custompage_view_tile('viewname', FALSE, 'page_2');

  // With all defaults
  custompage_view_tile('viewname');

  // For a particular display
  custompage_view_tile('viewname', 'page_2');

  // With a title
  custompage_view_tile('viewname', 'page_2', array('title' => 'Some Title Here'));

The options array also allows the list of options to grow without changing the function signature.

What do you think?

Comments

irakli’s picture

You are absolutely right. The API is not optimal :( I wish I thought of this early-on. However, now that CustomPage is widely used and API change would affect quite a number of installations (and having brutally suffered from other modules/core changing API) I can not in good conscience do this to existing developers in a minor update.

Maybe part of Drupal7 update? :)

irakli’s picture

Status: Active » Postponed