Preprocess_page let's messages disappear + Too much duplicate

derhasi - June 16, 2009 - 23:45
Project:Lightbox2
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Today in IRC we recognized through a member's problem, that lighbox2_preprocess_page() contains too much duplicate stuff from tempalte_preprocess_page(). As all registered preprocess are called each after another, they don't completely replace the function, but pass a the $variables by reference, so any function can edit them. For that less code would be needed, because template_preprocess_page() allready delas with most issues therein.

Especially a special problem occured regarding the $message variable (it contains system messages - status and error - set via drupal_set_message()). When theme('status_messages') is called a second time, because two preprocess (template_ & lightbox2_ call it, the message cache has allready been emptied, and so an empty $message-variable is being set. This leads to status messages that were never viewed to the user.

To reduce the duplicate entries in the preprocess I created attached patch.
There I also removed the template_files-suggestion procedure, because this is also allready performed by template_preprocess_page().

AttachmentSize
lightbox2_prerpocess_page.patch6.17 KB
 
 

Drupal is a registered trademark of Dries Buytaert.