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


PHP ThemeHandlerInterface::hasUi方法代码示例

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


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

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

示例2: getDerivativeDefinitions

 /**
  * {@inheritdoc}
  */
 public function getDerivativeDefinitions($base_plugin_definition)
 {
     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);
         }
     }
     return $this->derivatives;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:14,代码来源:ThemeLocalTask.php

示例3: 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)
 {
     if (!$this->themeHandler->hasUi($theme)) {
         throw new NotFoundHttpException();
     }
     $page = ['#title' => Html::escape($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:ddrozdik,项目名称:dmaps,代码行数:22,代码来源:BlockController.php

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

示例5: buildForm

 /**
  * {@inheritdoc}
  *
  * @param string $theme
  *   The theme name.
  */
 public function buildForm(array $form, FormStateInterface $form_state, $theme = '')
 {
     $form = parent::buildForm($form, $form_state);
     $themes = $this->themeHandler->listInfo();
     // Default settings are defined in theme_get_setting() in includes/theme.inc
     if ($theme) {
         if (!$this->themeHandler->hasUi($theme)) {
             throw new NotFoundHttpException();
         }
         $var = 'theme_' . $theme . '_settings';
         $config_key = $theme . '.settings';
         $themes = $this->themeHandler->listInfo();
         $features = $themes[$theme]->info['features'];
     } else {
         $var = 'theme_settings';
         $config_key = 'system.theme.global';
     }
     // @todo this is pretty meaningless since we're using theme_get_settings
     //   which means overrides can bleed into active config here. Will be fixed
     //   by https://www.drupal.org/node/2402467.
     $this->editableConfig = [$config_key];
     $form['var'] = array('#type' => 'hidden', '#value' => $var);
     $form['config_key'] = array('#type' => 'hidden', '#value' => $config_key);
     // Toggle settings
     $toggles = array('node_user_picture' => t('User pictures in posts'), 'comment_user_picture' => t('User pictures in comments'), 'comment_user_verification' => t('User verification status in comments'), 'favicon' => t('Shortcut icon'));
     // Some features are not always available
     $disabled = array();
     if (!user_picture_enabled()) {
         $disabled['toggle_node_user_picture'] = TRUE;
         $disabled['toggle_comment_user_picture'] = TRUE;
     }
     if (!$this->moduleHandler->moduleExists('comment')) {
         $disabled['toggle_comment_user_picture'] = TRUE;
         $disabled['toggle_comment_user_verification'] = TRUE;
     }
     $form['theme_settings'] = array('#type' => 'details', '#title' => t('Toggle display'), '#open' => TRUE, '#description' => t('Enable or disable the display of certain page elements.'));
     foreach ($toggles as $name => $title) {
         if (!$theme || in_array($name, $features)) {
             $form['theme_settings']['toggle_' . $name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => theme_get_setting('features.' . $name, $theme));
             // Disable checkboxes for features not supported in the current configuration.
             if (isset($disabled['toggle_' . $name])) {
                 $form['theme_settings']['toggle_' . $name]['#disabled'] = TRUE;
             }
         }
     }
     if (!Element::children($form['theme_settings'])) {
         // If there is no element in the theme settings details then do not show
         // it -- but keep it in the form if another module wants to alter.
         $form['theme_settings']['#access'] = FALSE;
     }
     // Logo settings, only available when file.module is enabled.
     if (!$theme || in_array('logo', $features) && $this->moduleHandler->moduleExists('file')) {
         $form['logo'] = array('#type' => 'details', '#title' => t('Logo image settings'), '#open' => TRUE, '#states' => array('invisible' => array('input[name="toggle_logo"]' => array('checked' => FALSE))));
         $form['logo']['default_logo'] = array('#type' => 'checkbox', '#title' => t('Use the default logo supplied by the theme'), '#default_value' => theme_get_setting('logo.use_default', $theme), '#tree' => FALSE);
         $form['logo']['settings'] = array('#type' => 'container', '#states' => array('invisible' => array('input[name="default_logo"]' => array('checked' => TRUE))));
         $form['logo']['settings']['logo_path'] = array('#type' => 'textfield', '#title' => t('Path to custom logo'), '#default_value' => theme_get_setting('logo.path', $theme));
         $form['logo']['settings']['logo_upload'] = array('#type' => 'file', '#title' => t('Upload logo image'), '#maxlength' => 40, '#description' => t("If you don't have direct file access to the server, use this field to upload your logo."));
     }
     if ((!$theme || in_array('favicon', $features)) && $this->moduleHandler->moduleExists('file')) {
         $form['favicon'] = array('#type' => 'details', '#title' => t('Shortcut icon settings'), '#open' => TRUE, '#description' => t("Your shortcut icon, or 'favicon', is displayed in the address bar and bookmarks of most browsers."), '#states' => array('invisible' => array('input[name="toggle_favicon"]' => array('checked' => FALSE))));
         $form['favicon']['default_favicon'] = array('#type' => 'checkbox', '#title' => t('Use the default shortcut icon supplied by the theme'), '#default_value' => theme_get_setting('favicon.use_default', $theme));
         $form['favicon']['settings'] = array('#type' => 'container', '#states' => array('invisible' => array('input[name="default_favicon"]' => array('checked' => TRUE))));
         $form['favicon']['settings']['favicon_path'] = array('#type' => 'textfield', '#title' => t('Path to custom icon'), '#default_value' => theme_get_setting('favicon.path', $theme));
         $form['favicon']['settings']['favicon_upload'] = array('#type' => 'file', '#title' => t('Upload icon image'), '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon."));
     }
     // Inject human-friendly values and form element descriptions for logo and
     // favicon.
     foreach (array('logo' => 'logo.svg', 'favicon' => 'favicon.ico') as $type => $default) {
         if (isset($form[$type]['settings'][$type . '_path'])) {
             $element =& $form[$type]['settings'][$type . '_path'];
             // If path is a public:// URI, display the path relative to the files
             // directory; stream wrappers are not end-user friendly.
             $original_path = $element['#default_value'];
             $friendly_path = NULL;
             if (file_uri_scheme($original_path) == 'public') {
                 $friendly_path = file_uri_target($original_path);
                 $element['#default_value'] = $friendly_path;
             }
             // Prepare local file path for description.
             if ($original_path && isset($friendly_path)) {
                 $local_file = strtr($original_path, array('public:/' => PublicStream::basePath()));
             } elseif ($theme) {
                 $local_file = drupal_get_path('theme', $theme) . '/' . $default;
             } else {
                 $local_file = \Drupal::theme()->getActiveTheme()->getPath() . '/' . $default;
             }
             $element['#description'] = t('Examples: <code>@implicit-public-file</code> (for a file in the public filesystem), <code>@explicit-file</code>, or <code>@local-file</code>.', array('@implicit-public-file' => isset($friendly_path) ? $friendly_path : $default, '@explicit-file' => file_uri_scheme($original_path) !== FALSE ? $original_path : 'public://' . $default, '@local-file' => $local_file));
         }
     }
     if ($theme) {
         // Call engine-specific settings.
         $function = $themes[$theme]->prefix . '_engine_settings';
         if (function_exists($function)) {
             $form['engine_specific'] = array('#type' => 'details', '#title' => t('Theme-engine-specific settings'), '#open' => TRUE, '#description' => t('These settings only exist for the themes based on the %engine theme engine.', array('%engine' => $themes[$theme]->prefix)));
//.........这里部分代码省略.........
开发者ID:ddrozdik,项目名称:dmaps,代码行数:101,代码来源:ThemeSettingsForm.php


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