| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: utility.inc,v 1.1.2.2 2010/08/27 23:47:17 merlinofchaos Exp $ 3 4 /** 5 * @file 6 * Contains general utility functions for CTools that do not need to be 7 * in the module file. 8 * 9 * In particular, things that are only needed during hook_menu() and 10 * hook_theme() are placed here. 11 */ 12 13 /** 14 * Provide a hook passthrough to included files. 15 * 16 * To organize things neatly, each CTools tool gets its own toolname.$type.inc 17 * file. If it exists, it's loaded and ctools_$tool_$type() is executed. 18 * To save time we pass the $items array in so we don't need to do array 19 * addition. It modifies the array by reference and doesn't need to return it. 20 */ 21 function _ctools_passthrough(&$items, $type = 'theme') { 22 $files = drupal_system_listing('.' . $type . '.inc$', drupal_get_path('module', 'ctools') . '/includes', 'name', 0); 23 foreach ($files as $file) { 24 require_once './' . $file->filename; 25 list($tool) = explode('.', $file->name, 2); 26 27 $function = 'ctools_' . str_replace ('-', '_', $tool) . '_' . $type; 28 if (function_exists($function)) { 29 $function($items); 30 } 31 } 32 } 33 34 /** 35 * Implementation of hook_theme_registry_alter() 36 */ 37 function ctools_theme_registry_alter(&$registry) { 38 if ($registry['menu_local_tasks']['function'] == 'theme_menu_local_tasks') { 39 $registry['menu_local_tasks'] = array( 40 'function' => 'ctools_theme_menu_local_tasks', 41 'path' => drupal_get_path('module', 'ctools') . '/includes', 42 'file' => 'menu.inc', 43 ) + $registry['menu_local_tasks']; 44 } 45 46 if (isset($registry['help']['function']) && $registry['help']['function'] == 'theme_help') { 47 $registry['help'] = array( 48 'function' => 'ctools_menu_help', 49 'path' => drupal_get_path('module', 'ctools') . '/includes', 50 'file' => 'menu.inc', 51 ) + $registry['help']; 52 } 53 54 // Handle a special override for garland because it's cute and does its own 55 // thing with tabs and we can't ask users to edit a core theme for us. 56 if ($registry['menu_local_tasks']['function'] == 'phptemplate_menu_local_tasks' && 57 $registry['menu_local_tasks']['theme paths'][1] == 'themes/garland') { 58 $registry['menu_local_tasks'] = array( 59 'function' => 'ctools_garland_menu_local_tasks', 60 'path' => drupal_get_path('module', 'ctools') . '/includes', 61 'file' => 'menu.inc', 62 ) + $registry['menu_local_tasks']; 63 } 64 65 if (isset($registry['page']['preprocess functions'][2]) && 66 $registry['page']['preprocess functions'][2] == 'phptemplate_preprocess_page' && 67 $registry['page']['theme paths'][1] == 'themes/garland') { 68 $registry['page']['preprocess functions'][2] = 'ctools_garland_preprocess_page'; 69 } 70 71 // Move this one last last last so it can catch changes made by modules and themes. 72 $key = array_search('ctools_preprocess_page', $registry['page']['preprocess functions']); 73 if ($key) { 74 unset($registry['page']['preprocess functions'][$key]); 75 } 76 $registry['page']['preprocess functions'][] = 'ctools_preprocess_page'; 77 } 78
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |