Mercurial > defr > drupal > core
comparison includes/theme.inc @ 15:4347c45bb494 6.7
Drupal 6.7
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:32:44 +0100 |
parents | 8b6c45761e01 |
children |
comparison
equal
deleted
inserted
replaced
14:626fcabfa4b8 | 15:4347c45bb494 |
---|---|
1 <?php | 1 <?php |
2 // $Id: theme.inc,v 1.415.2.13 2008/10/16 13:50:59 dries Exp $ | 2 // $Id: theme.inc,v 1.415.2.17 2008/12/10 21:09:05 goba Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * The theme system, which controls the output of Drupal. | 6 * The theme system, which controls the output of Drupal. |
7 * | 7 * |
8 * The theme system allows for nearly all output of the Drupal system to be | 8 * The theme system allows for nearly all output of the Drupal system to be |
9 * customized by user themes. | 9 * customized by user themes. |
10 * | 10 * |
11 * @see <a href="http://drupal.org/node/171179">Theme guide</a> | 11 * @ingroup themeable |
12 * @see themeable | |
13 */ | 12 */ |
14 | 13 |
15 /** | 14 /** |
16 * @name Content markers | 15 * @name Content markers |
17 * @{ | 16 * @{ |
259 * cached preprocessors for the hook will not be merged with the newly set. | 258 * cached preprocessors for the hook will not be merged with the newly set. |
260 * This can be useful to themes and theme engines by giving them more control | 259 * This can be useful to themes and theme engines by giving them more control |
261 * over how and when the preprocess functions are run. | 260 * over how and when the preprocess functions are run. |
262 */ | 261 */ |
263 function _theme_process_registry(&$cache, $name, $type, $theme, $path) { | 262 function _theme_process_registry(&$cache, $name, $type, $theme, $path) { |
263 $result = array(); | |
264 $function = $name .'_theme'; | 264 $function = $name .'_theme'; |
265 if (function_exists($function)) { | 265 if (function_exists($function)) { |
266 $result = $function($cache, $type, $theme, $path); | 266 $result = $function($cache, $type, $theme, $path); |
267 | 267 |
268 foreach ($result as $hook => $info) { | 268 foreach ($result as $hook => $info) { |
355 $result[$hook]['preprocess functions'] = $info['preprocess functions']; | 355 $result[$hook]['preprocess functions'] = $info['preprocess functions']; |
356 } | 356 } |
357 | 357 |
358 // Merge the newly created theme hooks into the existing cache. | 358 // Merge the newly created theme hooks into the existing cache. |
359 $cache = array_merge($cache, $result); | 359 $cache = array_merge($cache, $result); |
360 } | |
361 | |
362 // Let themes have preprocess functions even if they didn't register a template. | |
363 if ($type == 'theme' || $type == 'base_theme') { | |
364 foreach ($cache as $hook => $info) { | |
365 // Check only if it's a template and not registered by the theme or engine. | |
366 if (!empty($info['template']) && empty($result[$hook])) { | |
367 if (!isset($info['preprocess functions'])) { | |
368 $cache[$hook]['preprocess functions'] = array(); | |
369 } | |
370 if (function_exists($name .'_preprocess')) { | |
371 $cache[$hook]['preprocess functions'][] = $name .'_preprocess'; | |
372 } | |
373 if (function_exists($name .'_preprocess_'. $hook)) { | |
374 $cache[$hook]['preprocess functions'][] = $name .'_preprocess_'. $hook; | |
375 } | |
376 // Ensure uniqueness. | |
377 $cache[$hook]['preprocess functions'] = array_unique($cache[$hook]['preprocess functions']); | |
378 } | |
379 } | |
360 } | 380 } |
361 } | 381 } |
362 | 382 |
363 /** | 383 /** |
364 * Rebuild the hook theme_registry cache. | 384 * Rebuild the hook theme_registry cache. |
745 } | 765 } |
746 if (function_exists($prefix .'_'. $hook)) { | 766 if (function_exists($prefix .'_'. $hook)) { |
747 $templates[$hook] = array( | 767 $templates[$hook] = array( |
748 'function' => $prefix .'_'. $hook, | 768 'function' => $prefix .'_'. $hook, |
749 ); | 769 ); |
770 // Ensure that the pattern is maintained from base themes to its sub-themes. | |
771 // Each sub-theme will have their functions scanned so the pattern must be | |
772 // held for subsequent runs. | |
773 if (isset($info['pattern'])) { | |
774 $templates[$hook]['pattern'] = $info['pattern']; | |
775 } | |
750 } | 776 } |
751 } | 777 } |
752 } | 778 } |
753 | 779 |
754 return $templates; | 780 return $templates; |
809 if (isset($cache[$hook])) { | 835 if (isset($cache[$hook])) { |
810 $templates[$hook] = array( | 836 $templates[$hook] = array( |
811 'template' => $template, | 837 'template' => $template, |
812 'path' => dirname($file->filename), | 838 'path' => dirname($file->filename), |
813 ); | 839 ); |
840 } | |
841 // Ensure that the pattern is maintained from base themes to its sub-themes. | |
842 // Each sub-theme will have their templates scanned so the pattern must be | |
843 // held for subsequent runs. | |
844 if (isset($cache[$hook]['pattern'])) { | |
845 $templates[$hook]['pattern'] = $cache[$hook]['pattern']; | |
814 } | 846 } |
815 } | 847 } |
816 | 848 |
817 $patterns = array_keys($files); | 849 $patterns = array_keys($files); |
818 | 850 |
1407 * the array is used as the contents of the list item. If an item is an array | 1439 * the array is used as the contents of the list item. If an item is an array |
1408 * with a "children" element, those children are displayed in a nested list. | 1440 * with a "children" element, those children are displayed in a nested list. |
1409 * All other elements are treated as attributes of the list item element. | 1441 * All other elements are treated as attributes of the list item element. |
1410 * @param $title | 1442 * @param $title |
1411 * The title of the list. | 1443 * The title of the list. |
1444 * @param $type | |
1445 * The type of list to return (e.g. "ul", "ol") | |
1412 * @param $attributes | 1446 * @param $attributes |
1413 * The attributes applied to the list element. | 1447 * The attributes applied to the list element. |
1414 * @param $type | |
1415 * The type of list to return (e.g. "ul", "ol") | |
1416 * @return | 1448 * @return |
1417 * A string containing the list output. | 1449 * A string containing the list output. |
1418 */ | 1450 */ |
1419 function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) { | 1451 function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) { |
1420 $output = '<div class="item-list">'; | 1452 $output = '<div class="item-list">'; |