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


PHP ThemeHandlerInterface::listInfo方法代码示例

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


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

示例1: buildConfigurationForm

 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form['theme'] = array('#type' => 'select', '#title' => $this->t('Theme'), '#default_value' => $this->configuration['theme'], '#options' => array_map(function ($theme_info) {
         return $theme_info->info['name'];
     }, $this->themeHandler->listInfo()));
     return parent::buildConfigurationForm($form, $form_state);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:CurrentThemeCondition.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildForm($form, $form_state);
     $config = $this->config('views.settings');
     $options = array();
     foreach ($this->themeHandler->listInfo() as $name => $theme) {
         if ($theme->status) {
             $options[$name] = $theme->info['name'];
         }
     }
     // This is not currently a fieldset but we may want it to be later,
     // so this will make it easier to change if we do.
     $form['basic'] = array();
     $form['basic']['ui_show_master_display'] = array('#type' => 'checkbox', '#title' => $this->t('Always show the master (default) display'), '#default_value' => $config->get('ui.show.master_display'));
     $form['basic']['ui_show_advanced_column'] = array('#type' => 'checkbox', '#title' => $this->t('Always show advanced display settings'), '#default_value' => $config->get('ui.show.advanced_column'));
     $form['basic']['ui_show_display_embed'] = array('#type' => 'checkbox', '#title' => t('Allow embedded displays'), '#description' => t('Embedded displays can be used in code via views_embed_view().'), '#default_value' => $config->get('ui.show.display_embed'));
     $form['basic']['ui_exposed_filter_any_label'] = array('#type' => 'select', '#title' => $this->t('Label for "Any" value on non-required single-select exposed filters'), '#options' => array('old_any' => '<Any>', 'new_any' => $this->t('- Any -')), '#default_value' => $config->get('ui.exposed_filter_any_label'));
     $form['live_preview'] = array('#type' => 'details', '#title' => $this->t('Live preview settings'), '#open' => TRUE);
     $form['live_preview']['ui_always_live_preview'] = array('#type' => 'checkbox', '#title' => $this->t('Automatically update preview on changes'), '#default_value' => $config->get('ui.always_live_preview'));
     $form['live_preview']['ui_show_preview_information'] = array('#type' => 'checkbox', '#title' => $this->t('Show information and statistics about the view during live preview'), '#default_value' => $config->get('ui.show.preview_information'));
     $form['live_preview']['options'] = array('#type' => 'container', '#states' => array('visible' => array(':input[name="ui_show_preview_information"]' => array('checked' => TRUE))));
     $form['live_preview']['options']['ui_show_sql_query_enabled'] = array('#type' => 'checkbox', '#title' => $this->t('Show the SQL query'), '#default_value' => $config->get('ui.show.sql_query.enabled'));
     $form['live_preview']['options']['ui_show_sql_query_where'] = array('#type' => 'radios', '#states' => array('visible' => array(':input[name="ui_show_sql_query_enabled"]' => array('checked' => TRUE))), '#title' => t('Show SQL query'), '#options' => array('above' => $this->t('Above the preview'), 'below' => $this->t('Below the preview')), '#default_value' => $config->get('ui.show.sql_query.where'));
     $form['live_preview']['options']['ui_show_performance_statistics'] = array('#type' => 'checkbox', '#title' => $this->t('Show performance statistics'), '#default_value' => $config->get('ui.show.performance_statistics'));
     $form['live_preview']['options']['ui_show_additional_queries'] = array('#type' => 'checkbox', '#title' => $this->t('Show other queries run during render during live preview'), '#description' => $this->t("Drupal has the potential to run many queries while a view is being rendered. Checking this box will display every query run during view render as part of the live preview."), '#default_value' => $config->get('ui.show.additional_queries'));
     return $form;
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:30,代码来源:BasicSettingsForm.php

示例3: getExtensions

 /**
  * {@inheritdoc}
  */
 public function getExtensions()
 {
     foreach ($this->moduleHandler->getModuleList() as $module) {
         (yield $this->wrapCoreExtension($module));
     }
     foreach ($this->themeHandler->listInfo() as $theme) {
         (yield $this->wrapCoreExtension($theme));
     }
 }
开发者ID:hugronaphor,项目名称:cornel,代码行数:12,代码来源:ExtensionHandler.php

示例4: collect

 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = NULL)
 {
     $modules = $this->moduleHandler->getModuleList();
     $themes = $this->themeHandler->listInfo();
     $this->data['drupal_extension']['count'] = count($modules) + count($themes);
     $this->data['drupal_extension']['modules'] = $modules;
     $this->data['drupal_extension']['themes'] = $themes;
     $this->data['drupal_extension']['installation_path'] = $this->root . '/';
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:12,代码来源:ExtensionDataCollector.php

示例5: getDerivativeDefinitions

 /**
  * {@inheritdoc}
  */
 public function getDerivativeDefinitions($base_plugin_definition)
 {
     foreach ($this->themeHandler->listInfo() as $theme_name => $theme) {
         if ($theme->status) {
             $this->derivatives[$theme_name] = $base_plugin_definition;
             $this->derivatives[$theme_name]['title'] = $theme->info['name'];
             $this->derivatives[$theme_name]['route_parameters'] = array('theme' => $theme_name);
         }
     }
     return $this->derivatives;
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:14,代码来源:ThemeLocalTask.php

示例6: __construct

 /**
  * Theme constructor.
  *
  * @param \Drupal\Core\Extension\Extension $theme
  *   A theme \Drupal\Core\Extension\Extension object.
  * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
  *   The theme handler object.
  */
 public function __construct(Extension $theme, ThemeHandlerInterface $theme_handler)
 {
     $name = $theme->getName();
     $this->theme = $theme;
     $this->themeHandler = $theme_handler;
     $this->themes = $this->themeHandler->listInfo();
     $this->info = isset($this->themes[$name]->info) ? $this->themes[$name]->info : [];
     // Only install the theme if there is no schema version currently set.
     if (!$this->getSetting('schema')) {
         $this->install();
     }
 }
开发者ID:archual,项目名称:drupal_materialize_theme,代码行数:20,代码来源:Theme.php

示例7: onSave

 /**
  * Invalidate the 'rendered' cache tag whenever a theme setting is modified.
  *
  * @param \Drupal\Core\Config\ConfigCrudEvent $event
  *   The Event to process.
  */
 public function onSave(ConfigCrudEvent $event)
 {
     // Global theme settings.
     if ($event->getConfig()->getName() === 'system.theme.global') {
         $this->cacheTagsInvalidator->invalidateTags(['rendered']);
     }
     // Theme-specific settings, check if this matches a theme settings
     // configuration object, in that case, clear the rendered cache tag.
     foreach (array_keys($this->themeHandler->listInfo()) as $theme_name) {
         if ($theme_name == $event->getConfig()->getName()) {
             $this->cacheTagsInvalidator->invalidateTags(['rendered']);
             break;
         }
     }
 }
开发者ID:dev981,项目名称:gaptest,代码行数:21,代码来源:ThemeSettingsCacheTag.php

示例8: getExtensions

 /**
  * Gets all extensions.
  *
  * @return array
  */
 protected function getExtensions()
 {
     if (!isset($this->extensions)) {
         $this->extensions = array_merge($this->moduleHandler->getModuleList(), $this->themeHandler->listInfo());
     }
     return $this->extensions;
 }
开发者ID:shawnmmatthews,项目名称:gerber8,代码行数:12,代码来源:ThemeInitialization.php

示例9: setDefaultTheme

 /**
  * Set the default theme.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   A request object containing a theme name.
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  *   Redirects back to the appearance admin page.
  *
  * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
  *   Throws access denied when no theme is set in the request.
  */
 public function setDefaultTheme(Request $request)
 {
     $config = $this->configFactory->getEditable('system.theme');
     $theme = $request->query->get('theme');
     if (isset($theme)) {
         // Get current list of themes.
         $themes = $this->themeHandler->listInfo();
         // Check if the specified theme is one recognized by the system.
         // Or try to install the theme.
         if (isset($themes[$theme]) || $this->themeHandler->install(array($theme))) {
             $themes = $this->themeHandler->listInfo();
             // Set the default theme.
             $config->set('default', $theme)->save();
             $this->routeBuilder->setRebuildNeeded();
             // The status message depends on whether an admin theme is currently in
             // use: a value of 0 means the admin theme is set to be the default
             // theme.
             $admin_theme = $config->get('admin');
             if ($admin_theme != 0 && $admin_theme != $theme) {
                 drupal_set_message($this->t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array('%admin_theme' => $themes[$admin_theme]->info['name'], '%selected_theme' => $themes[$theme]->info['name'])));
             } else {
                 drupal_set_message($this->t('%theme is now the default theme.', array('%theme' => $themes[$theme]->info['name'])));
             }
         } else {
             drupal_set_message($this->t('The %theme theme was not found.', array('%theme' => $theme)), 'error');
         }
         return $this->redirect('system.themes_page');
     }
     throw new AccessDeniedHttpException();
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:42,代码来源:ThemeController.php

示例10: __construct

 /**
  * Constructs a TwigEnvironment object and stores cache and storage
  * internally.
  */
 public function __construct(\Twig_LoaderInterface $loader = NULL, $options = array(), ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler)
 {
     // @todo Pass as arguments from the DIC.
     $this->cache_object = \Drupal::cache();
     // Ensure that twig.engine is loaded, given that it is needed to render a
     // template because functions like twig_drupal_escape_filter are called.
     require_once DRUPAL_ROOT . '/core/themes/engines/twig/twig.engine';
     // Set twig path namespace for themes and modules.
     $namespaces = array();
     foreach ($module_handler->getModuleList() as $name => $extension) {
         $namespaces[$name] = $extension->getPath();
     }
     foreach ($theme_handler->listInfo() as $name => $extension) {
         $namespaces[$name] = $extension->getPath();
     }
     foreach ($namespaces as $name => $path) {
         $templatesDirectory = $path . '/templates';
         if (file_exists($templatesDirectory)) {
             $loader->addPath($templatesDirectory, $name);
         }
     }
     $this->templateClasses = array();
     $this->stringLoader = new \Twig_Loader_String();
     parent::__construct($loader, $options);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:29,代码来源:TwigEnvironment.php

示例11: getThemePath

 /**
  * Get the path to a theme.
  *
  * @param string $theme
  *   The machine name of the theme to get the path for.
  *
  * @return string
  *   The path to the given theme.
  *
  * @todo replace this with an injectable version of drupal_get_path() when/if
  *  it lands.
  */
 protected function getThemePath($theme)
 {
     $info = $this->themeHandler->listInfo();
     $path = '';
     if (isset($info[$theme])) {
         $path = dirname($info[$theme]->uri);
     }
     return $path;
 }
开发者ID:gerbreown1,项目名称:calvaryfree,代码行数:21,代码来源:PrintableCssInclude.php

示例12: addForm

 /**
  * Presents the custom block creation form.
  *
  * @param \Drupal\block_content\BlockContentTypeInterface $block_content_type
  *   The custom block type to add.
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The current request object.
  *
  * @return array
  *   A form array as expected by drupal_render().
  */
 public function addForm(BlockContentTypeInterface $block_content_type, Request $request)
 {
     $block = $this->blockContentStorage->create(array('type' => $block_content_type->id()));
     if (($theme = $request->query->get('theme')) && in_array($theme, array_keys($this->themeHandler->listInfo()))) {
         // We have navigated to this page from the block library and will keep track
         // of the theme for redirecting the user to the configuration page for the
         // newly created block in the given theme.
         $block->setTheme($theme);
     }
     return $this->entityFormBuilder()->getForm($block);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:22,代码来源:BlockContentController.php

示例13: getDerivativeDefinitions

 /**
  * {@inheritdoc}
  */
 public function getDerivativeDefinitions($base_plugin_definition)
 {
     $default_theme = $this->themeHandler->getDefault();
     foreach ($this->themeHandler->listInfo() as $theme_name => $theme) {
         if ($this->themeHandler->hasUi($theme_name)) {
             $this->derivatives[$theme_name] = $base_plugin_definition;
             $this->derivatives[$theme_name]['title'] = $theme->info['name'];
             $this->derivatives[$theme_name]['route_parameters'] = array('theme' => $theme_name);
         }
         // Default task!
         if ($default_theme == $theme_name) {
             $this->derivatives[$theme_name]['route_name'] = $base_plugin_definition['parent_id'];
             // Emulate default logic because without the base plugin id we can't
             // change the base_route.
             $this->derivatives[$theme_name]['weight'] = -10;
             unset($this->derivatives[$theme_name]['route_parameters']);
         }
     }
     return $this->derivatives;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:23,代码来源:ThemeLocalTask.php

示例14: onSave

 /**
  * Invalidate cache tags when particular system config objects are saved.
  *
  * @param \Drupal\Core\Config\ConfigCrudEvent $event
  *   The Event to process.
  */
 public function onSave(ConfigCrudEvent $event)
 {
     // Changing the site settings may mean a different route is selected for the
     // front page. Additionally a change to the site name or similar must
     // invalidate the render cache since this could be used anywhere.
     if ($event->getConfig()->getName() === 'system.site') {
         $this->cacheTagsInvalidator->invalidateTags(['route_match', 'rendered']);
     }
     // Theme configuration and global theme settings.
     if (in_array($event->getConfig()->getName(), ['system.theme', 'system.theme.global'], TRUE)) {
         $this->cacheTagsInvalidator->invalidateTags(['rendered']);
     }
     // Theme-specific settings, check if this matches a theme settings
     // configuration object, in that case, clear the rendered cache tag.
     foreach (array_keys($this->themeHandler->listInfo()) as $theme_name) {
         if ($theme_name == $event->getConfig()->getName()) {
             $this->cacheTagsInvalidator->invalidateTags(['rendered']);
             break;
         }
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:27,代码来源:ConfigCacheTag.php

示例15: getThemesList

 /**
  * Returns a list with all themes.
  *
  * @return array
  *   Associative array with all enabled themes:
  *   - name: label
  */
 protected function getThemesList()
 {
     $theme_options = array('current' => $this->t('Current'), 'default' => $this->t('Default'));
     if ($this->moduleHandler->moduleExists('domain_theme')) {
         $theme_options['domain'] = $this->t('Domain Theme');
     }
     foreach ($this->themeHandler->listInfo() as $name => $theme) {
         if ($theme->status === 1) {
             $theme_options[$name] = $theme->info['name'];
         }
     }
     return $theme_options;
 }
开发者ID:augustpascual-mse,项目名称:job-searching-network,代码行数:20,代码来源:AdminForm.php


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