API Change for view tile

febbraro - April 17, 2009 - 16:08
Project:Custom Page
Version:6.x-1.6
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

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?

#1

irakli - April 29, 2009 - 11:30

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? :)

#2

irakli - April 29, 2009 - 11:31
Status:active» postponed
 
 

Drupal is a registered trademark of Dries Buytaert.