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


PHP ModuleHandlerInterface::buildModuleDependencies方法代码示例

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


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

示例1: rebuildThemeData

 /**
  * {@inheritdoc}
  */
 public function rebuildThemeData()
 {
     $listing = $this->getExtensionDiscovery();
     $themes = $listing->scan('theme');
     $engines = $listing->scan('theme_engine');
     $extension_config = $this->configFactory->get('core.extension');
     $installed = $extension_config->get('theme') ?: array();
     // Set defaults for theme info.
     $defaults = array('engine' => 'twig', 'regions' => array('sidebar_first' => 'Left sidebar', 'sidebar_second' => 'Right sidebar', 'content' => 'Content', 'header' => 'Header', 'primary_menu' => 'Primary menu', 'secondary_menu' => 'Secondary menu', 'footer' => 'Footer', 'highlighted' => 'Highlighted', 'messages' => 'Messages', 'help' => 'Help', 'page_top' => 'Page top', 'page_bottom' => 'Page bottom', 'breadcrumb' => 'Breadcrumb'), 'description' => '', 'features' => $this->defaultFeatures, 'screenshot' => 'screenshot.png', 'php' => DRUPAL_MINIMUM_PHP, 'libraries' => array());
     $sub_themes = array();
     $files = array();
     // Read info files for each theme.
     foreach ($themes as $key => $theme) {
         // @todo Remove all code that relies on the $status property.
         $theme->status = (int) isset($installed[$key]);
         $theme->info = $this->infoParser->parse($theme->getPathname()) + $defaults;
         // Add the info file modification time, so it becomes available for
         // contributed modules to use for ordering theme lists.
         $theme->info['mtime'] = $theme->getMTime();
         // Invoke hook_system_info_alter() to give installed modules a chance to
         // modify the data in the .info.yml files if necessary.
         // @todo Remove $type argument, obsolete with $theme->getType().
         $type = 'theme';
         $this->moduleHandler->alter('system_info', $theme->info, $theme, $type);
         if (!empty($theme->info['base theme'])) {
             $sub_themes[] = $key;
             // Add the base theme as a proper dependency.
             $themes[$key]->info['dependencies'][] = $themes[$key]->info['base theme'];
         }
         // Defaults to 'twig' (see $defaults above).
         $engine = $theme->info['engine'];
         if (isset($engines[$engine])) {
             $theme->owner = $engines[$engine]->getExtensionPathname();
             $theme->prefix = $engines[$engine]->getName();
         }
         // Prefix screenshot with theme path.
         if (!empty($theme->info['screenshot'])) {
             $theme->info['screenshot'] = $theme->getPath() . '/' . $theme->info['screenshot'];
         }
         $files[$key] = $theme->getPathname();
     }
     // Build dependencies.
     // @todo Move into a generic ExtensionHandler base class.
     // @see https://drupal.org/node/2208429
     $themes = $this->moduleHandler->buildModuleDependencies($themes);
     // Store filenames to allow system_list() and drupal_get_filename() to
     // retrieve them without having to scan the filesystem.
     $this->state->set('system.theme.files', $files);
     // After establishing the full list of available themes, fill in data for
     // sub-themes.
     foreach ($sub_themes as $key) {
         $sub_theme = $themes[$key];
         // The $base_themes property is optional; only set for sub themes.
         // @see ThemeHandlerInterface::listInfo()
         $sub_theme->base_themes = $this->getBaseThemes($themes, $key);
         // empty() cannot be used here, since ThemeHandler::doGetBaseThemes() adds
         // the key of a base theme with a value of NULL in case it is not found,
         // in order to prevent needless iterations.
         if (!current($sub_theme->base_themes)) {
             continue;
         }
         // Determine the root base theme.
         $root_key = key($sub_theme->base_themes);
         // Build the list of sub-themes for each of the theme's base themes.
         foreach (array_keys($sub_theme->base_themes) as $base_theme) {
             $themes[$base_theme]->sub_themes[$key] = $sub_theme->info['name'];
         }
         // Add the theme engine info from the root base theme.
         if (isset($themes[$root_key]->owner)) {
             $sub_theme->info['engine'] = $themes[$root_key]->info['engine'];
             $sub_theme->owner = $themes[$root_key]->owner;
             $sub_theme->prefix = $themes[$root_key]->prefix;
         }
     }
     return $themes;
 }
开发者ID:brstde,项目名称:gap1,代码行数:79,代码来源:ThemeHandler.php


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