當前位置: 首頁>>代碼示例>>PHP>>正文


PHP theme_get_registry函數代碼示例

本文整理匯總了PHP中theme_get_registry函數的典型用法代碼示例。如果您正苦於以下問題:PHP theme_get_registry函數的具體用法?PHP theme_get_registry怎麽用?PHP theme_get_registry使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了theme_get_registry函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: collectFiles

 /**
  * Build the code files.
  */
 function collectFiles(&$files)
 {
     $theme_registry = theme_get_registry();
     // Our theme base was set in our incoming component data.
     $theme_base = $this->base_component->component_data['theme_hook_bases'][$this->name];
     $theme_info = $theme_registry[$theme_base];
     //drush_print_r($this);
     //drush_print_r($theme_info);
     // Get the original TPL file we want to copy.
     // Due to how the theme registry works, this will be one of:
     //  - the original file from the module
     //  - an overridden tpl file in the current theme (eg, if you request
     //    node--article, and your theme has node.tpl, then you get that)
     //  - an overridden tpl file in a parent theme, same principle.
     $original_tpl_file = $theme_info['path'] . '/' . $theme_info['template'] . '.tpl.php';
     $tpl_code = file_get_contents($original_tpl_file);
     //print $tpl_code;
     $theme_path = path_to_theme();
     // Try a 'templates' folder inside it.
     if (file_exists($theme_path . '/templates')) {
         $file_path .= 'templates';
     } else {
         $file_path = '';
     }
     $files['info'] = array('path' => $file_path, 'filename' => $this->name . '.tpl.php', 'body' => array($tpl_code));
 }
開發者ID:josoroma,項目名稱:lastime,代碼行數:29,代碼來源:ThemeTemplate.php

示例2: edit_form_submit

 function edit_form_submit(&$form, &$form_state)
 {
     parent::edit_form_submit($form, $form_state);
     // Ensure that the Stack layout theme exists in the theme registry,
     // otherwise, rebuild it.
     $theme_hooks = theme_get_registry();
     if (!isset($theme_hooks['panels_frame_stack'])) {
         drupal_theme_rebuild();
     }
 }
開發者ID:anatolic,項目名稱:vintage,代碼行數:10,代碼來源:panels_frame_stack_ui.class.php

示例3: setPreUpgradeMessage

 /**
  * Compute any messages which should be displayed beforeupgrade.
  *
  * Note: This function is called iteratively for each upcoming
  * revision to the database.
  *
  * @param $preUpgradeMessage
  * @param string $rev
  *   a version number, e.g. '4.3.alpha1', '4.3.beta3', '4.3.0'.
  * @param null $currentVer
  *
  * @return void|bool
  */
 public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL)
 {
     if ($rev == '4.3.beta3') {
         //CRM-12084
         //sql for checking orphaned contribution records
         $sql = "SELECT COUNT(ct.id) FROM civicrm_contribution ct LEFT JOIN civicrm_contact c ON ct.contact_id = c.id WHERE c.id IS NULL";
         $count = CRM_Core_DAO::singleValueQuery($sql, array(), TRUE, FALSE);
         if ($count > 0) {
             $error = ts("There is a data integrity issue with this CiviCRM database. It contains %1 contribution records which are linked to contact records that have been deleted. You will need to correct this manually before you can run the upgrade. Use the following MySQL query to identify the problem records: %2 These records will need to be deleted or linked to an existing contact record.", array(1 => $count, 2 => '<em>SELECT ct.* FROM civicrm_contribution ct LEFT JOIN civicrm_contact c ON ct.contact_id = c.id WHERE c.id IS NULL;</em>'));
             CRM_Core_Error::fatal($error);
             return FALSE;
         }
     }
     if ($rev == '4.3.beta4' && CRM_Utils_Constant::value('CIVICRM_UF', FALSE) == 'Drupal6') {
         // CRM-11823 - Make sure the D6 HTML HEAD technique will work on
         // upgrade pages ... except when we're in Drush.
         if (!function_exists('drush_main')) {
             theme('item_list', array());
             // force-load theme registry
             $theme_registry = theme_get_registry();
             if (!isset($theme_registry['page']['preprocess functions']) || FALSE === array_search('civicrm_preprocess_page_inject', $theme_registry['page']['preprocess functions'])) {
                 CRM_Core_Error::fatal('Please reset the Drupal cache (Administer => Site Configuration => Performance => Clear cached data))');
             }
         }
     }
     if ($rev == '4.3.6') {
         $constraintArray = array('civicrm_contact' => 'contact_id', 'civicrm_payment_processor' => 'payment_processor_id');
         if (version_compare('4.1alpha1', $currentVer) <= 0) {
             $constraintArray['civicrm_campaign'] = 'campaign_id';
         }
         if (version_compare('4.3alpha1', $currentVer) <= 0) {
             $constraintArray['civicrm_financial_type'] = 'financial_type_id';
         }
         foreach ($constraintArray as $key => $value) {
             $query = "SELECT contri_recur.id FROM civicrm_contribution_recur contri_recur LEFT JOIN {$key} ON contri_recur.{$value} = {$key}.id\nWHERE {$key}.id IS NULL";
             if ($value != 'contact_id') {
                 $query .= " AND contri_recur.{$value} IS NOT NULL ";
             }
             $dao = CRM_Core_DAO::executeQuery($query);
             if ($dao->N) {
                 $invalidDataMessage = '<strong>Oops, it looks like you have orphaned recurring contribution records in your database. Before this upgrade can complete they will need to be fixed or deleted. <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Orphaned+Contribution+Recur+Records" target="_blank">You can review steps to correct this situation on the documentation wiki.</a></strong>';
                 CRM_Core_Error::fatal($invalidDataMessage);
                 return FALSE;
             }
         }
     }
 }
開發者ID:JSProffitt,項目名稱:civicrm-website-org,代碼行數:60,代碼來源:FourThree.php

示例4: requiredComponents

 /**
  * Declares the subcomponents for this component.
  *
  * These are not necessarily child classes, just components this needs.
  *
  * @return
  *  An array of subcomponent types.
  */
 protected function requiredComponents()
 {
     $theme_data = $this->component_data;
     //drush_print_r($theme_data);
     drupal_theme_initialize();
     $theme_registry = theme_get_registry();
     $components = array();
     foreach ($this->component_data['themeables'] as $theme_hook_name) {
         $hook = $theme_hook_name;
         // Iteratively strip everything after the last '--' delimiter, until an
         // implementation is found.
         // (We use -- rather than __ because they're easier to type!)
         // TODO: allow both!
         while ($pos = strrpos($hook, '--')) {
             $hook = substr($hook, 0, $pos);
             if (isset($theme_registry[$hook])) {
                 break;
             }
         }
         if (!isset($theme_registry[$hook])) {
             // Bad name. Skip it.
             continue;
         }
         //drush_print_r($hook);
         if (isset($theme_registry[$hook]['template'])) {
             $components[$theme_hook_name] = 'themeTemplate';
             // Store data about this theme hook that we've found.
             $this->component_data['theme_hook_bases'][$theme_hook_name] = $hook;
         } else {
             // Fall through, as 'function' is optional in hook_theme().
             // TODO: we don't do theme functions yet -- need a system to add code
             // to existing files!
             //$components[$theme_hook_name] = 'theme_function';
         }
     }
     //drush_print_r($components);
     return $components;
 }
開發者ID:josoroma,項目名稱:lastime,代碼行數:46,代碼來源:Theme.php

示例5: hook_preprocess

/**
 * Preprocess theme variables for templates.
 *
 * This hook allows modules to preprocess theme variables for theme templates.
 * It is called for all theme hooks implemented as templates, but not for theme
 * hooks implemented as functions. hook_preprocess_HOOK() can be used to
 * preprocess variables for a specific theme hook, whether implemented as a
 * template or function.
 *
 * For more detailed information, see _theme().
 *
 * @param $variables
 *   The variables array (modify in place).
 * @param $hook
 *   The name of the theme hook.
 */
function hook_preprocess(&$variables, $hook)
{
    static $hooks;
    // Add contextual links to the variables, if the user has permission.
    if (!\Drupal::currentUser()->hasPermission('access contextual links')) {
        return;
    }
    if (!isset($hooks)) {
        $hooks = theme_get_registry();
    }
    // Determine the primary theme function argument.
    if (isset($hooks[$hook]['variables'])) {
        $keys = array_keys($hooks[$hook]['variables']);
        $key = $keys[0];
    } else {
        $key = $hooks[$hook]['render element'];
    }
    if (isset($variables[$key])) {
        $element = $variables[$key];
    }
    if (isset($element) && is_array($element) && !empty($element['#contextual_links'])) {
        $variables['title_suffix']['contextual_links'] = contextual_links_view($element);
        if (!empty($variables['title_suffix']['contextual_links'])) {
            $variables['attributes']['class'][] = 'contextual-links-region';
        }
    }
}
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:43,代碼來源:theme.api.php

示例6: tao_blocks

/**
 * Override of theme_blocks().
 * Allows additional theme functions to be defined per region to
 * control block display on a per-region basis. Falls back to default
 * block region handling if no region-specific overrides are found.
 */
function tao_blocks($region)
{
    // Allow theme functions some additional control over regions.
    $registry = theme_get_registry();
    if (isset($registry['blocks_' . $region])) {
        return theme('blocks_' . $region);
    }
    return module_exists('context') && function_exists('context_blocks') ? context_blocks($region) : theme_blocks($region);
}
開發者ID:rmontero,項目名稱:dla_ecommerce_site,代碼行數:15,代碼來源:template.php

示例7: themeRegistry

 public function themeRegistry()
 {
     $hooks = theme_get_registry();
     ksort($hooks);
     return array('#markup' => kprint_r($hooks, TRUE));
 }
開發者ID:atif-shaikh,項目名稱:DCX-Profile,代碼行數:6,代碼來源:DevelController.php

示例8: tao_blocks

/**
 * Override of theme_blocks().
 * Allows additional theme functions to be defined per region to
 * control block display on a per-region basis. Falls back to default
 * block region handling if no region-specific overrides are found.
 */
function tao_blocks($region)
{
    static $list;
    $output = '';
    $list = module_exists('context') && function_exists('context_block_list') ? context_block_list($region) : block_list($region);
    // Allow theme functions some additional control over regions
    if ($list) {
        $registry = theme_get_registry();
        if (isset($registry['blocks_' . $region])) {
            $output .= theme('blocks_' . $region, $list);
        } else {
            foreach ($list as $key => $block) {
                $output .= theme("block", $block);
            }
            $output .= drupal_get_content($region);
        }
        return $output;
    }
    return '';
}
開發者ID:ricardoreis,項目名稱:Atrium,代碼行數:26,代碼來源:template.php

示例9: themeRegistry

 public function themeRegistry()
 {
     drupal_theme_initialize();
     $hooks = theme_get_registry();
     ksort($hooks);
     return kprint_r($hooks, TRUE);
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:7,代碼來源:DevelController.php

示例10: ddbasic_preprocess_node

/**
 * Implements hook_preprocess_node().
 *
 * Override or insert variables into the node templates.
 */
function ddbasic_preprocess_node(&$variables, $hook)
{
    // Opening hours on library list. but not on the search page.
    $path = drupal_get_path_alias();
    if (!(strpos($path, 'search', 0) === 0)) {
        $hooks = theme_get_registry(FALSE);
        if (isset($hooks['opening_hours_week']) && $variables['type'] == 'ding_library') {
            $variables['opening_hours'] = theme('opening_hours_week', array('node' => $variables['node']));
        }
    }
    // Add ddbasic_byline to variables.
    $variables['ddbasic_byline'] = t('By: ');
    // Add event node specific ddbasic variables.
    if (isset($variables['content']['#bundle']) && $variables['content']['#bundle'] == 'ding_event') {
        // Add event location variables.
        if (!empty($variables['content']['field_ding_event_location'][0]['#address']['name_line'])) {
            $variables['ddbasic_event_location'] = $variables['content']['field_ding_event_location'][0]['#address']['name_line'] . '<br/>' . $variables['content']['field_ding_event_location'][0]['#address']['thoroughfare'] . ', ' . $variables['content']['field_ding_event_location'][0]['#address']['locality'];
        } else {
            // User OG group ref to link back to library.
            if (isset($variables['content']['og_group_ref'])) {
                $variables['ddbasic_event_location'] = $variables['content']['og_group_ref'];
            }
        }
        // Add event date to variables. A render array is created based on the date
        // format "date_only".
        $event_date_ra = field_view_field('node', $variables['node'], 'field_ding_event_date', array('label' => 'hidden', 'type' => 'date_default', 'settings' => array('format_type' => 'ding_date_only', 'fromto' => 'both')));
        $variables['ddbasic_event_date'] = $event_date_ra[0]['#markup'];
        // Add event time to variables. A render array is created based on the date
        // format "time_only".
        $event_time_ra = field_view_field('node', $variables['node'], 'field_ding_event_date', array('label' => 'hidden', 'type' => 'date_default', 'settings' => array('format_type' => 'ding_time_only', 'fromto' => 'both')));
        $variables['ddbasic_event_time'] = $event_time_ra[0]['#markup'];
    }
    // Add tpl suggestions for node view modes.
    if (isset($variables['view_mode'])) {
        $variables['theme_hook_suggestions'][] = 'node__view_mode__' . $variables['view_mode'];
    }
    // Add "read more" links to event, news and e-resource in search result view
    // mode.
    if ($variables['view_mode'] == 'search_result') {
        switch ($variables['node']->type) {
            case 'ding_event':
                $more_link = array('#theme' => 'link', '#text' => '<i class="icon-chevron-right"></i>', '#path' => 'node/' . $variables['nid'], '#options' => array('attributes' => array('title' => $variables['title']), 'html' => TRUE), '#prefix' => '<div class="event-arrow-link">', '#surfix' => '</div>', '#weight' => 6);
                $variables['content']['group_right_col_search']['more_link'] = $more_link;
                break;
            case 'ding_news':
                $more_link = array('#theme' => 'link', '#text' => t('Read more'), '#path' => 'node/' . $variables['nid'], '#options' => array('attributes' => array('title' => $variables['title']), 'html' => FALSE), '#prefix' => '<span class="news-link">', '#surfix' => '</span>', '#weight' => 6);
                $variables['content']['group_right_col_search']['more_link'] = $more_link;
                break;
            case 'ding_eresource':
                $more_link = array('#theme' => 'link', '#text' => t('Read more'), '#path' => 'node/' . $variables['nid'], '#options' => array('attributes' => array('title' => $variables['title']), 'html' => FALSE), '#prefix' => '<span class="eresource-link">', '#surfix' => '</span>', '#weight' => 6);
                $variables['content']['group_right_col_search']['more_link'] = $more_link;
                break;
        }
    }
    // For search result view mode move title into left col. group.
    if (isset($variables['content']['group_right_col_search'])) {
        $variables['content']['group_right_col_search']['title'] = array('#theme' => 'link', '#text' => decode_entities($variables['title']), '#path' => 'node/' . $variables['nid'], '#options' => array('attributes' => array('title' => $variables['title']), 'html' => FALSE), '#prefix' => '<h2>', '#suffix' => '</h2>');
    }
    // Add updated to variables.
    $variables['ddbasic_updated'] = t('!datetime', array('!datetime' => format_date($variables['node']->changed, $type = 'long', $format = '', $timezone = NULL, $langcode = NULL)));
    // Modified submitted variable.
    if ($variables['display_submitted']) {
        $variables['submitted'] = t('!datetime', array('!datetime' => format_date($variables['created'], $type = 'long', $format = '', $timezone = NULL, $langcode = NULL)));
    }
}
開發者ID:eReolen,項目名稱:ding2,代碼行數:70,代碼來源:template.php

示例11: tao_blocks

/**
 * Override of theme_blocks().
 * Allows additional theme functions to be defined per region to
 * control block display on a per-region basis. Falls back to default
 * block region handling if no region-specific overrides are found.
 */
function tao_blocks($region)
{
    // Bail if this region has been disabled through context.
    if (module_exists('context')) {
        $disabled_regions = context_active_values('theme_regiontoggle');
        if (!empty($disabled_regions) && in_array($region, $disabled_regions)) {
            return '';
        }
    }
    $output = '';
    $list = module_exists('context') && function_exists('context_block_list') ? context_block_list($region) : block_list($region);
    if (!empty($list)) {
        // Allow theme functions some additional control over regions
        $registry = theme_get_registry();
        if (isset($registry['blocks_' . $region])) {
            return theme('blocks_' . $region, $list);
        }
        // Otherwise, flow through regular stack
        foreach ($list as $key => $block) {
            $output .= theme("block", $block);
        }
    }
    return $output . drupal_get_content($region);
}
開發者ID:kkaefer,項目名稱:Atrium,代碼行數:30,代碼來源:template.php


注:本文中的theme_get_registry函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。