Drupal has three ways to set a simple page title. That seems like a bit much. This patch removes setting the title via theme_page() and leaves setting it via hook_menu() and drupal_set_title(). This makes themes easier to write and module source code easier to read. This patch also removes setting the breadcrumb path via theme_page(). That argument actually was never used in Drupal core.

Themes actually don't need to be updated, but they should. Here is some text to paste in http://drupal.org/node/12352:

theme_page() no longer takes $title or $breadcrumb arguments. Remove the two arguments and any special handling of them. All page titles and breadcrumbs can be retieved from drupal_get_title() and drupal_get_breadcrumb().

Contributed modules should be updated. Here is some text for http://drupal.org/node/12347:

theme_page() no longer takes $title or breadcrumb arguments, Instead, set page titles using hook_menu() or, if the title must be dynamically determined, use drupal_set_title(). Set breadcrumb trails first using hook_menu(), which can be overridden with menu_set_location() and drupal_set_breadcrumb().

CommentFileSizeAuthor
less_title_setting.diff20.46 KBdrumm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

-1. I use these features all the time. Same for many Contrib modules.

chrismessina’s picture

I'm concerned that this patch might actually remove some control from the theme level... Moshe, can you describe how you use these functions so I can understand the impact better?

drumm’s picture

#1: No features or capabilities are removed, just have to do a separate function call instead.

#2: This makes themes simpler because you only have to look in one place for the page title and breadcrumb instead of two. Less logic in theme functions is always a good thing.

Bèr Kessels’s picture

+1 from me. Its a big step forwards to consitancy. Titles (and breadcrumbs) that are not set trough the menu() are impossible to change by site admins (its bad useability to have some titles and paths settable,a nd others not). And removes double functionality.
we should rather have goodone way of doing things, than two ways of doing the same.

Dries’s picture

IMO, it is a good change, although it makes things slightly more verbose and slightly less convenient. I think I'll commit this shortly, unless someone can convince me not to.

moshe weitzman’s picture

exactly - slightly more verbose. This patch will result in more code, not less. Modules will be forced to call both drupal_set_breadcrumb() and drupal_set_title(). Two new lines for lots of theme('page') calls. Seems like astep backward to me. Perhaps jonBob could comment, since he put in that functionality.

drumm’s picture

I still think this would be a net benefit.

* Less logic in theme code.
* Encourages use of the menu system.
* Easier to find where a title or breadcrumb comes from in other people's code because there are less places to look. Look in menu and then grep for the appropriate set function. Looking for calls to theme_page() is hard because there are too many of them.
* Very slightly more efficient.

Yes, it is more lines of code and more verbosity, but I think it is a good tradeoff to make.

Dries’s picture

Committed to HEAD. Thanks.

Anonymous’s picture