annotate sites/all/modules/ctools/includes/utility.inc @ 11:b0ee71395280

deleted .DS_Store files
author danieleb <danielebarchiesi@me.com>
date Mon, 28 Oct 2013 16:12:13 +0000
parents ff03f76ab3fe
children
rev   line source
danielebarchiesi@0 1 <?php
danielebarchiesi@0 2
danielebarchiesi@0 3 /**
danielebarchiesi@0 4 * @file
danielebarchiesi@0 5 * Contains general utility functions for CTools that do not need to be
danielebarchiesi@0 6 * in the module file.
danielebarchiesi@0 7 *
danielebarchiesi@0 8 * In particular, things that are only needed during hook_menu() and
danielebarchiesi@0 9 * hook_theme() are placed here.
danielebarchiesi@0 10 */
danielebarchiesi@0 11
danielebarchiesi@0 12 /**
danielebarchiesi@0 13 * Provide a hook passthrough to included files.
danielebarchiesi@0 14 *
danielebarchiesi@0 15 * To organize things neatly, each CTools tool gets its own toolname.$type.inc
danielebarchiesi@0 16 * file. If it exists, it's loaded and ctools_$tool_$type() is executed.
danielebarchiesi@0 17 * To save time we pass the $items array in so we don't need to do array
danielebarchiesi@0 18 * addition. It modifies the array by reference and doesn't need to return it.
danielebarchiesi@0 19 */
danielebarchiesi@0 20 function ctools_passthrough($module, $type, &$items) {
danielebarchiesi@0 21 $files = file_scan_directory(drupal_get_path('module', $module) . '/includes', '/\.' . $type . '\.inc$/', array('key' => 'name'));
danielebarchiesi@0 22 foreach ($files as $file) {
danielebarchiesi@0 23 require_once DRUPAL_ROOT . '/' . $file->uri;
danielebarchiesi@0 24 list($tool) = explode('.', $file->name, 2);
danielebarchiesi@0 25
danielebarchiesi@0 26 $function = $module . '_' . str_replace ('-', '_', $tool) . '_' . str_replace('-', '_', $type);
danielebarchiesi@0 27 if (function_exists($function)) {
danielebarchiesi@0 28 $function($items);
danielebarchiesi@0 29 }
danielebarchiesi@0 30 }
danielebarchiesi@0 31 }
danielebarchiesi@0 32
danielebarchiesi@0 33 /**
danielebarchiesi@0 34 * Implementation of hook_theme_registry_alter()
danielebarchiesi@0 35 */
danielebarchiesi@0 36 function ctools_theme_registry_alter(&$registry) {
danielebarchiesi@0 37 // Move this one last last last so it can catch changes made by modules and themes.
danielebarchiesi@0 38 $key = array_search('ctools_preprocess_page', $registry['page']['preprocess functions']);
danielebarchiesi@0 39 if ($key) {
danielebarchiesi@0 40 unset($registry['page']['preprocess functions'][$key]);
danielebarchiesi@0 41 }
danielebarchiesi@0 42 $registry['page']['preprocess functions'][] = 'ctools_preprocess_page';
danielebarchiesi@0 43 }
danielebarchiesi@0 44