当前位置: 首页>>代码示例>>PHP>>正文


PHP ThemeHandlerInterface::rebuildThemeData方法代码示例

本文整理汇总了PHP中Drupal\Core\Extension\ThemeHandlerInterface::rebuildThemeData方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHandlerInterface::rebuildThemeData方法的具体用法?PHP ThemeHandlerInterface::rebuildThemeData怎么用?PHP ThemeHandlerInterface::rebuildThemeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Extension\ThemeHandlerInterface的用法示例。


在下文中一共展示了ThemeHandlerInterface::rebuildThemeData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getThemeData

 /**
  * Gets theme data.
  *
  * @return \Drupal\Core\Extension\Extension[]
  */
 protected function getThemeData()
 {
     if (!isset($this->themeData)) {
         $this->themeData = $this->themeHandler->rebuildThemeData();
     }
     return $this->themeData;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:12,代码来源:ConfigImportSubscriber.php

示例2: getProjects

 /**
  * {@inheritdoc}
  */
 public function getProjects()
 {
     if (empty($this->projects)) {
         // Retrieve the projects from storage, if present.
         $this->projects = $this->projectStorage('update_project_projects');
         if (empty($this->projects)) {
             // Still empty, so we have to rebuild.
             $module_data = system_rebuild_module_data();
             $theme_data = $this->themeHandler->rebuildThemeData();
             $project_info = new ProjectInfo();
             $project_info->processInfoList($this->projects, $module_data, 'module', TRUE);
             $project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE);
             if ($this->updateSettings->get('check.disabled_extensions')) {
                 $project_info->processInfoList($this->projects, $module_data, 'module', FALSE);
                 $project_info->processInfoList($this->projects, $theme_data, 'theme', FALSE);
             }
             // Allow other modules to alter projects before fetching and comparing.
             $this->moduleHandler->alter('update_projects', $this->projects);
             // Store the site's project data for at most 1 hour.
             $this->keyValueStore->setWithExpire('update_project_projects', $this->projects, 3600);
         }
     }
     return $this->projects;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:27,代码来源:UpdateManager.php

示例3: themesPage

 /**
  * Returns a theme listing.
  *
  * @return string
  *   An HTML string of the theme listing page.
  *
  * @todo Move into ThemeController.
  */
 public function themesPage()
 {
     $config = $this->config('system.theme');
     // Get all available themes.
     $themes = $this->themeHandler->rebuildThemeData();
     uasort($themes, 'system_sort_modules_by_info_name');
     $theme_default = $config->get('default');
     $theme_groups = array('installed' => array(), 'uninstalled' => array());
     $admin_theme = $config->get('admin');
     $admin_theme_options = array();
     foreach ($themes as &$theme) {
         if (!empty($theme->info['hidden'])) {
             continue;
         }
         $theme->is_default = $theme->getName() == $theme_default;
         $theme->is_admin = $theme->getName() == $admin_theme || $theme->is_default && $admin_theme == '0';
         // Identify theme screenshot.
         $theme->screenshot = NULL;
         // Create a list which includes the current theme and all its base themes.
         if (isset($themes[$theme->getName()]->base_themes)) {
             $theme_keys = array_keys($themes[$theme->getName()]->base_themes);
             $theme_keys[] = $theme->getName();
         } else {
             $theme_keys = array($theme->getName());
         }
         // Look for a screenshot in the current theme or in its closest ancestor.
         foreach (array_reverse($theme_keys) as $theme_key) {
             if (isset($themes[$theme_key]) && file_exists($themes[$theme_key]->info['screenshot'])) {
                 $theme->screenshot = array('uri' => $themes[$theme_key]->info['screenshot'], 'alt' => $this->t('Screenshot for !theme theme', array('!theme' => $theme->info['name'])), 'title' => $this->t('Screenshot for !theme theme', array('!theme' => $theme->info['name'])), 'attributes' => array('class' => array('screenshot')));
                 break;
             }
         }
         if (empty($theme->status)) {
             // Ensure this theme is compatible with this version of core.
             // Require the 'content' region to make sure the main page
             // content has a common place in all themes.
             $theme->incompatible_core = !isset($theme->info['core']) || $theme->info['core'] != \DRUPAL::CORE_COMPATIBILITY || !isset($theme->info['regions']['content']);
             $theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0;
             // Confirmed that the base theme is available.
             $theme->incompatible_base = isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']]);
             // Confirm that the theme engine is available.
             $theme->incompatible_engine = isset($theme->info['engine']) && !isset($theme->owner);
         }
         $theme->operations = array();
         if (!empty($theme->status) || !$theme->incompatible_core && !$theme->incompatible_php && !$theme->incompatible_base && !$theme->incompatible_engine) {
             // Create the operations links.
             $query['theme'] = $theme->getName();
             if ($this->themeAccess->checkAccess($theme->getName())) {
                 $theme->operations[] = array('title' => $this->t('Settings'), 'url' => Url::fromRoute('system.theme_settings_theme', ['theme' => $theme->getName()]), 'attributes' => array('title' => $this->t('Settings for !theme theme', array('!theme' => $theme->info['name']))));
             }
             if (!empty($theme->status)) {
                 if (!$theme->is_default) {
                     $theme_uninstallable = TRUE;
                     if ($theme->getName() == $admin_theme) {
                         $theme_uninstallable = FALSE;
                     }
                     // Check it isn't the base of theme of an installed theme.
                     foreach ($theme->required_by as $themename => $dependency) {
                         if (!empty($themes[$themename]->status)) {
                             $theme_uninstallable = FALSE;
                         }
                     }
                     if ($theme_uninstallable) {
                         $theme->operations[] = array('title' => $this->t('Uninstall'), 'url' => Url::fromRoute('system.theme_uninstall'), 'query' => $query, 'attributes' => array('title' => $this->t('Uninstall !theme theme', array('!theme' => $theme->info['name']))));
                     }
                     $theme->operations[] = array('title' => $this->t('Set as default'), 'url' => Url::fromRoute('system.theme_set_default'), 'query' => $query, 'attributes' => array('title' => $this->t('Set !theme as default theme', array('!theme' => $theme->info['name']))));
                 }
                 $admin_theme_options[$theme->getName()] = $theme->info['name'];
             } else {
                 $theme->operations[] = array('title' => $this->t('Install'), 'url' => Url::fromRoute('system.theme_install'), 'query' => $query, 'attributes' => array('title' => $this->t('Install !theme theme', array('!theme' => $theme->info['name']))));
                 $theme->operations[] = array('title' => $this->t('Install and set as default'), 'url' => Url::fromRoute('system.theme_set_default'), 'query' => $query, 'attributes' => array('title' => $this->t('Install !theme as default theme', array('!theme' => $theme->info['name']))));
             }
         }
         // Add notes to default and administration theme.
         $theme->notes = array();
         if ($theme->is_default) {
             $theme->notes[] = $this->t('default theme');
         }
         if ($theme->is_admin) {
             $theme->notes[] = $this->t('admin theme');
         }
         // Sort installed and uninstalled themes into their own groups.
         $theme_groups[$theme->status ? 'installed' : 'uninstalled'][] = $theme;
     }
     // There are two possible theme groups.
     $theme_group_titles = array('installed' => $this->formatPlural(count($theme_groups['installed']), 'Installed theme', 'Installed themes'));
     if (!empty($theme_groups['uninstalled'])) {
         $theme_group_titles['uninstalled'] = $this->formatPlural(count($theme_groups['uninstalled']), 'Uninstalled theme', 'Uninstalled themes');
     }
     uasort($theme_groups['installed'], 'system_sort_themes');
     $this->moduleHandler()->alter('system_themes_page', $theme_groups);
     $build = array();
//.........这里部分代码省略.........
开发者ID:nstielau,项目名称:drops-8,代码行数:101,代码来源:SystemController.php

示例4: __construct

 /**
  * Constructs an export object.
  *
  * @param array $export
  *  The details of the export to build
  */
 public function __construct(ThemeHandlerInterface $theme_handler)
 {
     $this->themeHandler = $theme_handler;
     $this->themes = $this->themeHandler->rebuildThemeData();
 }
开发者ID:edwardchan,项目名称:d8-drupalvm,代码行数:11,代码来源:OmegaExport.php


注:本文中的Drupal\Core\Extension\ThemeHandlerInterface::rebuildThemeData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。