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


PHP Extension\ThemeHandlerInterface类代码示例

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


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

示例1: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     // Create a config mock which does not mock the clear(), set() and get() methods.
     $methods = get_class_methods('Drupal\\Core\\Config\\Config');
     unset($methods[array_search('set', $methods)]);
     unset($methods[array_search('get', $methods)]);
     unset($methods[array_search('clear', $methods)]);
     $config_mock = $this->getMockBuilder('Drupal\\Core\\Config\\Config')->disableOriginalConstructor()->setMethods($methods)->getMock();
     // Create the config factory we use in the submitForm() function.
     $this->configFactory = $this->getMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
     $this->configFactory->expects($this->any())->method('getEditable')->will($this->returnValue($config_mock));
     // Create a MailsystemManager mock.
     $this->mailManager = $this->getMock('\\Drupal\\mailsystem\\MailsystemManager', array(), array(), '', FALSE);
     $this->mailManager->expects($this->any())->method('getDefinition')->will($this->returnValueMap(array(array('mailsystem_test', TRUE, array('label' => 'Test Mail-Plugin')), array('mailsystem_demo', TRUE, array('label' => 'Demo Mail-Plugin')))));
     $this->mailManager->expects($this->any())->method('getDefinitions')->will($this->returnValue(array(array('id' => 'mailsystem_test', 'label' => 'Test Mail-Plugin'), array('id' => 'mailsystem_demo', 'label' => 'Demo Mail-Plugin'))));
     // Create a module handler mock.
     $this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
     $this->moduleHandler->expects($this->any())->method('getImplementations')->with('mail')->will($this->returnValue(array('mailsystem_test', 'mailsystem_demo')));
     $this->moduleHandler->expects($this->any())->method('moduleExists')->withAnyParameters()->will($this->returnValue(FALSE));
     // Create a theme handler mock.
     $this->themeHandler = $this->getMock('\\Drupal\\Core\\Extension\\ThemeHandlerInterface');
     $this->themeHandler->expects($this->any())->method('listInfo')->will($this->returnValue(array('test_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name')), 'demo_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name demo')), 'inactive_theme' => (object) array('status' => 0, 'info' => array('name' => 'inactive test theme')))));
     // Inject a language-manager into \Drupal.
     $this->languageManager = $this->getMock('\\Drupal\\Core\\StringTranslation\\TranslationInterface');
     $this->languageManager->expects($this->any())->method('translate')->withAnyParameters()->will($this->returnArgument(0));
     $container = new ContainerBuilder();
     $container->set('string_translation', $this->languageManager);
     \Drupal::setContainer($container);
 }
开发者ID:augustpascual-mse,项目名称:job-searching-network,代码行数:32,代码来源:AdminFormTest.php

示例2: __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

示例3: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->directoryList = array('system' => 'core/modules/system');
     $this->themeHandler = $this->getMock('Drupal\\Core\\Extension\\ThemeHandlerInterface');
     $theme = new Extension('theme', DRUPAL_ROOT . '/core/themes/bartik', 'bartik.info.yml');
     $theme->status = 1;
     $theme->info = array('name' => 'bartik');
     $this->themeHandler->expects($this->any())->method('listInfo')->will($this->returnValue(array('bartik' => $theme)));
     $this->container->set('theme_handler', $this->themeHandler);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:14,代码来源:SystemLocalTasksTest.php

示例4: __construct

 /**
  * Constructs a new FilesystemLoader object.
  *
  * @param string|array $paths
  *   A path or an array of paths to check for templates.
  * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
  *   The module handler service.
  * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
  *   The theme handler service.
  */
 public function __construct($paths = array(), ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler)
 {
     parent::__construct($paths);
     // Add namespaced paths for modules and themes.
     $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) {
         $this->addPath($path . '/templates', $name);
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:25,代码来源:FilesystemLoader.php

示例5: 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

示例6: 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

示例7: listing

 /**
  * Shows the block administration page.
  *
  * @param string|null $theme
  *   Theme key of block list.
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The current request.
  *
  * @return array
  *   A render array as expected by drupal_render().
  */
 public function listing($theme = NULL, Request $request = NULL)
 {
     $theme = $theme ?: $this->config('system.theme')->get('default');
     if (!$this->themeHandler->hasUi($theme)) {
         throw new NotFoundHttpException();
     }
     return $this->entityManager()->getListBuilder('block')->render($theme, $request);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:19,代码来源:BlockListController.php

示例8: testUpdateHookN

 /**
  * Tests that the Stable base theme is installed if necessary.
  */
 public function testUpdateHookN()
 {
     $this->assertTrue($this->themeHandler->themeExists('test_stable'));
     $this->assertFalse($this->themeHandler->themeExists('stable'));
     $this->runUpdates();
     // Refresh the theme handler now that Stable has been installed.
     $this->themeHandler->refreshInfo();
     $this->assertTrue($this->themeHandler->themeExists('stable'));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:StableBaseThemeUpdateTest.php

示例9: testWildWest

 /**
  * Tests opting out of Stable by setting the base theme to false.
  */
 public function testWildWest()
 {
     $this->themeHandler->install(['test_wild_west']);
     $this->config('system.theme')->set('default', 'test_wild_west')->save();
     $theme = $this->themeManager->getActiveTheme();
     /** @var \Drupal\Core\Theme\ActiveTheme $base_theme */
     $base_themes = $theme->getBaseThemes();
     $this->assertTrue(empty($base_themes), 'No base theme is set when a theme has opted out of using Stable.');
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:12,代码来源:StableThemeTest.php

示例10: 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

示例11: 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

示例12: demo

 /**
  * Returns a block theme demo page.
  *
  * @param string $theme
  *   The name of the theme.
  *
  * @return array
  *   A #type 'page' render array containing the block region demo.
  */
 public function demo($theme)
 {
     $page = ['#title' => $this->themeHandler->getName($theme), '#type' => 'page', '#attached' => array('drupalSettings' => ['path' => ['currentPathIsAdmin' => TRUE]], 'library' => array('block/drupal.block.admin'))];
     // Show descriptions in each visible page region, nothing else.
     $visible_regions = $this->getVisibleRegionNames($theme);
     foreach (array_keys($visible_regions) as $region) {
         $page[$region]['block_description'] = array('#type' => 'inline_template', '#template' => '<div class="block-region demo-block">{{ region_name }}</div>', '#context' => array('region_name' => $visible_regions[$region]));
     }
     return $page;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:19,代码来源:BlockController.php

示例13: 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

示例14: 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

示例15: 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


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