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


PHP UrlGeneratorInterface::generateFromRoute方法代码示例

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


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

示例1: collect

 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = NULL)
 {
     if ($this->translation instanceof TranslationManagerWrapper) {
         /** \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper $this->translation */
         $this->data['translations']['translated'] = $this->translation->getTranslated();
         $this->data['translations']['untranslated'] = $this->translation->getUntranslated();
     }
     $data['user_interface_translations_path'] = $this->urlGenerator->generateFromRoute('locale.translate_page');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:TranslationsDataCollector.php

示例2: testProcessOutbound

 /**
  * Tests the output process.
  */
 public function testProcessOutbound()
 {
     $expected_cacheability = (new BubbleableMetadata())->addCacheContexts(['route'])->setCacheMaxAge(Cache::PERMANENT);
     $request_stack = \Drupal::requestStack();
     /** @var \Symfony\Component\Routing\RequestContext $request_context */
     $request_context = \Drupal::service('router.request_context');
     // Test request with subdir on homepage.
     $server = ['SCRIPT_NAME' => '/subdir/index.php', 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', 'SERVER_NAME' => 'http://www.example.com'];
     $request = Request::create('/subdir/', 'GET', [], [], [], $server);
     $request->attributes->set(RouteObjectInterface::ROUTE_NAME, '<front>');
     $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('/'));
     $request_stack->push($request);
     $request_context->fromRequest($request);
     $url = GeneratedUrl::createFromObject($expected_cacheability)->setGeneratedUrl('/subdir/');
     $this->assertEqual($url, $this->urlGenerator->generateFromRoute('<current>', [], [], TRUE));
     // Test request with subdir on other page.
     $server = ['SCRIPT_NAME' => '/subdir/index.php', 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', 'SERVER_NAME' => 'http://www.example.com'];
     $request = Request::create('/subdir/node/add', 'GET', [], [], [], $server);
     $request->attributes->set(RouteObjectInterface::ROUTE_NAME, 'node.add');
     $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('/node/add'));
     $request_stack->push($request);
     $request_context->fromRequest($request);
     $url = GeneratedUrl::createFromObject($expected_cacheability)->setGeneratedUrl('/subdir/node/add');
     $this->assertEqual($url, $this->urlGenerator->generateFromRoute('<current>', [], [], TRUE));
     // Test request without subdir on the homepage.
     $server = ['SCRIPT_NAME' => '/index.php', 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', 'SERVER_NAME' => 'http://www.example.com'];
     $request = Request::create('/', 'GET', [], [], [], $server);
     $request->attributes->set(RouteObjectInterface::ROUTE_NAME, '<front>');
     $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('/'));
     $request_stack->push($request);
     $request_context->fromRequest($request);
     $url = GeneratedUrl::createFromObject($expected_cacheability)->setGeneratedUrl('/');
     $this->assertEqual($url, $this->urlGenerator->generateFromRoute('<current>', [], [], TRUE));
     // Test request without subdir on other page.
     $server = ['SCRIPT_NAME' => '/index.php', 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', 'SERVER_NAME' => 'http://www.example.com'];
     $request = Request::create('/node/add', 'GET', [], [], [], $server);
     $request->attributes->set(RouteObjectInterface::ROUTE_NAME, 'node.add');
     $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('/node/add'));
     $request_stack->push($request);
     $request_context->fromRequest($request);
     $url = GeneratedUrl::createFromObject($expected_cacheability)->setGeneratedUrl('/node/add');
     $this->assertEqual($url, $this->urlGenerator->generateFromRoute('<current>', [], [], TRUE));
     // Test request without a found route. This happens for example on an
     // not found exception page.
     $server = ['SCRIPT_NAME' => '/index.php', 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', 'SERVER_NAME' => 'http://www.example.com'];
     $request = Request::create('/invalid-path', 'GET', [], [], [], $server);
     $request_stack->push($request);
     $request_context->fromRequest($request);
     // In case we have no routing, the current route should point to the front,
     // and the cacheability does not depend on the 'route' cache context, since
     // no route was involved at all: this is fallback behavior.
     $url = GeneratedUrl::createFromObject((new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT))->setGeneratedUrl('/');
     $this->assertEqual($url, $this->urlGenerator->generateFromRoute('<current>', [], [], TRUE));
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:57,代码来源:RouteProcessorCurrentIntegrationTest.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $config = $this->config('ckeditor_media_embed.settings');
     $form['embed_provider'] = array('#type' => 'textfield', '#title' => $this->t('Provider URL'), '#default_value' => $config->get('embed_provider'), '#description' => $this->t('A template for the URL of the provider endpoint.
     This URL will be queried for each resource to be embedded. By default CKEditor uses the Iframely service.<br />
     <strong>Example</strong> <code>//example.com/api/oembed-proxy?resource-url={url}&callback={callback}</code><br />
     <strong>Default</strong> <code>//ckeditor.iframe.ly/api/oembed?url={url}&callback={callback}</code><br />
   '));
     if ($this->moduleHandler->moduleExists('help')) {
         $form['embed_provider']['#description'] .= $this->t('Check out the <a href=":help">help</a> page for more information.<br />', array(':help' => $this->urlGenerator->generateFromRoute('help.page', array('name' => 'ckeditor_media_embed'))));
     }
     return parent::buildForm($form, $form_state);
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:16,代码来源:CKEditorMediaEmbedSettingsForm.php

示例4: get

 /**
  * {@inheritdoc}
  */
 public function get()
 {
     if (!isset($this->destination)) {
         $query = $this->requestStack->getCurrentRequest()->query;
         if (UrlHelper::isExternal($query->get('destination'))) {
             $this->destination = '/';
         } elseif ($query->has('destination')) {
             $this->destination = $query->get('destination');
         } else {
             $this->destination = $this->urlGenerator->generateFromRoute('<current>', [], ['query' => UrlHelper::buildQuery(UrlHelper::filterQueryParameters($query->all()))]);
         }
     }
     return $this->destination;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:17,代码来源:RedirectDestination.php

示例5: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $bundles = $this->mediaBundleStorage->loadMultiple();
     if (empty($bundles)) {
         $create_url = $this->urlGenerator->generateFromRoute('media.bundle_add');
         $this->setMessage($this->t('You do not have any media bundles that can be generated. <a href="@create-bundle">Go create a new media bundle</a>', ['@create-bundle' => $create_url]), 'error', FALSE);
         return [];
     }
     $options = [];
     foreach ($bundles as $bundle) {
         $options[$bundle->id()] = ['bundle' => ['#markup' => $bundle->label()]];
     }
     $form['media_bundles'] = ['#type' => 'tableselect', '#header' => ['bundle' => $this->t('Media bundle')], '#options' => $options];
     $form['kill'] = ['#type' => 'checkbox', '#title' => $this->t('<strong>Delete all media</strong> in these bundles before generating new media.'), '#default_value' => $this->getSetting('kill')];
     $form['num'] = ['#type' => 'number', '#title' => $this->t('How many media items would you like to generate?'), '#default_value' => $this->getSetting('num'), '#required' => TRUE, '#min' => 0];
     $options = [1 => $this->t('Now')];
     foreach ([3600, 86400, 604800, 2592000, 31536000] as $interval) {
         $options[$interval] = $this->dateFormatter->formatInterval($interval, 1) . ' ' . $this->t('ago');
     }
     $form['time_range'] = ['#type' => 'select', '#title' => $this->t('How far back in time should the media be dated?'), '#description' => $this->t('Media creation dates will be distributed randomly from the current time, back to the selected time.'), '#options' => $options, '#default_value' => 604800];
     $form['name_length'] = ['#type' => 'number', '#title' => $this->t('Maximum number of words in names'), '#default_value' => $this->getSetting('name_length'), '#required' => TRUE, '#min' => 1, '#max' => 255];
     $options = [];
     // We always need a language.
     $languages = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL);
     foreach ($languages as $langcode => $language) {
         $options[$langcode] = $language->getName();
     }
     $form['add_language'] = ['#type' => 'select', '#title' => $this->t('Set language on media'), '#multiple' => TRUE, '#description' => $this->t('Requires locale.module'), '#options' => $options, '#default_value' => [$this->languageManager->getDefaultLanguage()->getId()]];
     $form['#redirect'] = FALSE;
     return $form;
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:34,代码来源:MediaDevelGenerate.php

示例6: render

 /**
  * {@inheritdoc}
  */
 public function render() {
   $build = parent::render();
   $build['#empty'] = t('No eform types available. <a href="@link">Add EForm type</a>.', array(
     '@link' => $this->urlGenerator->generateFromRoute('eform.type_add'),
   ));
   return $build;
 }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:10,代码来源:EFormTypeListBuilder.php

示例7: forbiddenMessage

 /**
  * {@inheritdoc}
  */
 public function forbiddenMessage(EntityInterface $entity, $field_name)
 {
     if (!isset($this->authenticatedCanPostComments)) {
         // We only output a link if we are certain that users will get the
         // permission to post comments by logging in.
         $this->authenticatedCanPostComments = $this->entityManager->getStorage('user_role')->load(DRUPAL_AUTHENTICATED_RID)->hasPermission('post comments');
     }
     if ($this->authenticatedCanPostComments) {
         // We cannot use drupal_get_destination() because these links
         // sometimes appear on /node and taxonomy listing pages.
         if ($entity->get($field_name)->getFieldDefinition()->getSetting('form_location') == CommentItemInterface::FORM_SEPARATE_PAGE) {
             $destination = array('destination' => 'comment/reply/' . $entity->getEntityTypeId() . '/' . $entity->id() . '/' . $field_name . '#comment-form');
         } else {
             $destination = array('destination' => $entity->getSystemPath() . '#comment-form');
         }
         if ($this->userConfig->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
             // Users can register themselves.
             return $this->t('<a href="@login">Log in</a> or <a href="@register">register</a> to post comments', array('@login' => $this->urlGenerator->generateFromRoute('user.login', array(), array('query' => $destination)), '@register' => $this->urlGenerator->generateFromRoute('user.register', array(), array('query' => $destination))));
         } else {
             // Only admins can add new users, no public registration.
             return $this->t('<a href="@login">Log in</a> to post comments', array('@login' => $this->urlGenerator->generateFromRoute('user.login', array(), array('query' => $destination))));
         }
     }
     return '';
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:28,代码来源:CommentManager.php

示例8: render

 /**
  * {@inheritdoc}
  */
 public function render() {
   $build = parent::render();
   $build['#empty'] = $this->t('There are currently no blocktabs. <a href=":url">Add a new one</a>.', array(
     ':url' => $this->urlGenerator->generateFromRoute('blocktabs.add'),
   ));
   return $build;
 }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:10,代码来源:BlocktabsListBuilder.php

示例9: render

 /**
  * {@inheritdoc}
  */
 public function render() {
   $build = parent::render();
   $build['table']['#empty'] = t('No crop types available. <a href="@link">Add crop type</a>.', [
     '@link' => $this->urlGenerator->generateFromRoute('crop.type_add'),
   ]);
   return $build;
 }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:10,代码来源:CropTypeListBuilder.php

示例10: generateFromRoute

 /**
  * {@inheritdoc}
  */
 public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE)
 {
     $generated_url = $this->urlGenerator->generateFromRoute($name, $parameters, $options, TRUE);
     if (!$collect_bubbleable_metadata) {
         $this->bubble($generated_url, $options);
     }
     return $collect_bubbleable_metadata ? $generated_url : $generated_url->getGeneratedUrl();
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:11,代码来源:MetadataBubblingUrlGenerator.php

示例11: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $types = $this->nodeTypeStorage->loadMultiple();
     if (empty($types)) {
         $create_url = $this->urlGenerator->generateFromRoute('node.type_add');
         $this->setMessage($this->t('You do not have any content types that can be generated. <a href=":create-type">Go create a new content type</a>', array(':create-type' => $create_url)), 'error', FALSE);
         return;
     }
     $options = array();
     foreach ($types as $type) {
         $options[$type->id()] = array('type' => array('#markup' => $type->label()));
         if ($this->commentManager) {
             $comment_fields = $this->commentManager->getFields('node');
             $map = array($this->t('Hidden'), $this->t('Closed'), $this->t('Open'));
             $fields = array();
             foreach ($comment_fields as $field_name => $info) {
                 // Find all comment fields for the bundle.
                 if (in_array($type->id(), $info['bundles'])) {
                     $instance = FieldConfig::loadByName('node', $type->id(), $field_name);
                     $default_value = $instance->getDefaultValueLiteral();
                     $default_mode = reset($default_value);
                     $fields[] = new FormattableMarkup('@field: @state', array('@field' => $instance->label(), '@state' => $map[$default_mode['status']]));
                 }
             }
             // @todo Refactor display of comment fields.
             if (!empty($fields)) {
                 $options[$type->id()]['comments'] = array('data' => array('#theme' => 'item_list', '#items' => $fields));
             } else {
                 $options[$type->id()]['comments'] = $this->t('No comment fields');
             }
         }
     }
     $header = array('type' => $this->t('Content type'));
     if ($this->commentManager) {
         $header['comments'] = array('data' => $this->t('Comments'), 'class' => array(RESPONSIVE_PRIORITY_MEDIUM));
     }
     $form['node_types'] = array('#type' => 'tableselect', '#header' => $header, '#options' => $options);
     $form['kill'] = array('#type' => 'checkbox', '#title' => $this->t('<strong>Delete all content</strong> in these content types before generating new content.'), '#default_value' => $this->getSetting('kill'));
     $form['num'] = array('#type' => 'number', '#title' => $this->t('How many nodes would you like to generate?'), '#default_value' => $this->getSetting('num'), '#required' => TRUE, '#min' => 0);
     $options = array(1 => $this->t('Now'));
     foreach (array(3600, 86400, 604800, 2592000, 31536000) as $interval) {
         $options[$interval] = $this->dateFormatter->formatInterval($interval, 1) . ' ' . $this->t('ago');
     }
     $form['time_range'] = array('#type' => 'select', '#title' => $this->t('How far back in time should the nodes be dated?'), '#description' => $this->t('Node creation dates will be distributed randomly from the current time, back to the selected time.'), '#options' => $options, '#default_value' => 604800);
     $form['max_comments'] = array('#type' => $this->moduleHandler->moduleExists('comment') ? 'number' : 'value', '#title' => $this->t('Maximum number of comments per node.'), '#description' => $this->t('You must also enable comments for the content types you are generating. Note that some nodes will randomly receive zero comments. Some will receive the max.'), '#default_value' => $this->getSetting('max_comments'), '#min' => 0, '#access' => $this->moduleHandler->moduleExists('comment'));
     $form['title_length'] = array('#type' => 'number', '#title' => $this->t('Maximum number of words in titles'), '#default_value' => $this->getSetting('title_length'), '#required' => TRUE, '#min' => 1, '#max' => 255);
     $form['add_alias'] = array('#type' => 'checkbox', '#disabled' => !$this->moduleHandler->moduleExists('path'), '#description' => $this->t('Requires path.module'), '#title' => $this->t('Add an url alias for each node.'), '#default_value' => FALSE);
     $form['add_statistics'] = array('#type' => 'checkbox', '#title' => $this->t('Add statistics for each node (node_counter table).'), '#default_value' => TRUE, '#access' => $this->moduleHandler->moduleExists('statistics'));
     $options = array();
     // We always need a language.
     $languages = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL);
     foreach ($languages as $langcode => $language) {
         $options[$langcode] = $language->getName();
     }
     $form['add_language'] = array('#type' => 'select', '#title' => $this->t('Set language on nodes'), '#multiple' => TRUE, '#description' => $this->t('Requires locale.module'), '#options' => $options, '#default_value' => array($this->languageManager->getDefaultLanguage()->getId()));
     $form['#redirect'] = FALSE;
     return $form;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:61,代码来源:ContentDevelGenerate.php

示例12: generateFromRoute

 /**
  * @param string|\Symfony\Component\Routing\Route $name
  * @param array $parameters
  * @param array $options
  * @param bool $collect_bubbleable_metadata
  * @return \Drupal\Core\GeneratedUrl|string
  */
 public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE)
 {
     $hostOverride = null;
     $originalHost = null;
     $action = array_key_exists('purl_context', $options) && $options['purl_context'] == false ? Context::EXIT_CONTEXT : Context::ENTER_CONTEXT;
     $this->contextHelper->preGenerate($this->matchedModifiers->createContexts($action), $name, $parameters, $options, $collect_bubbleable_metadata);
     if (isset($options['host']) && strlen((string) $options['host']) > 0) {
         $hostOverride = $options['host'];
         $originalHost = $this->getContext()->getHost();
         $this->getContext()->setHost($hostOverride);
     }
     $result = $this->urlGenerator->generateFromRoute($name, $parameters, $options, $collect_bubbleable_metadata);
     // Reset the original host in request context.
     if ($hostOverride) {
         $this->getContext()->setHost($originalHost);
     }
     return $result;
 }
开发者ID:activelamp,项目名称:purl-d8,代码行数:25,代码来源:UrlGenerator.php

示例13: getUrl

 /**
  * Generates an absolute URL given a route name and parameters.
  *
  * @param $name
  *   The name of the route.
  * @param array $parameters
  *   An associative array of route parameter names and values.
  * @param array $options
  *   (optional) An associative array of additional options. The 'absolute'
  *   option is forced to be TRUE.
  *
  * @return string
  *   The generated absolute URL for the given route.
  *
  * @todo Add an option for scheme-relative URLs.
  */
 public function getUrl($name, $parameters = array(), $options = array())
 {
     // Generate URL.
     $options['absolute'] = TRUE;
     $generated_url = $this->urlGenerator->generateFromRoute($name, $parameters, $options, TRUE);
     // Return as render array, so we can bubble the bubbleable metadata.
     $build = ['#markup' => $generated_url->getGeneratedUrl()];
     $generated_url->applyTo($build);
     return $build;
 }
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:26,代码来源:TwigExtension.php

示例14: onRequest

 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if (!devel_silent()) {
         if ($this->account->hasPermission('access devel information')) {
             devel_set_handler(devel_get_handlers());
             // We want to include the class early so that anyone may call krumo()
             // as needed. See http://krumo.sourceforge.net/
             has_krumo();
             // See http://www.firephp.org/HQ/Install.htm
             $path = NULL;
             if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                 // FirePHPCore is in include_path. Probably a PEAR installation.
                 $path = '';
             } elseif ($this->moduleHandler->moduleExists('libraries')) {
                 // Support Libraries API - http://drupal.org/project/libraries
                 $firephp_path = libraries_get_path('FirePHPCore');
                 $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                 $chromephp_path = libraries_get_path('chromephp');
             } else {
                 $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
                 $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
             }
             // Include FirePHP if it exists.
             if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                 include_once $firephp_path . 'fb.php';
                 include_once $firephp_path . 'FirePHP.class.php';
             }
             // Include ChromePHP if it exists.
             if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                 include_once $chromephp_path;
             }
         }
     }
     if ($this->config->get('rebuild_theme')) {
         drupal_theme_rebuild();
         // Ensure that the active theme object is cleared.
         $theme_name = \Drupal::theme()->getActiveTheme()->getName();
         \Drupal::state()->delete('theme.active_theme.' . $theme_name);
         \Drupal::theme()->resetActiveTheme();
         /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
         $theme_handler = \Drupal::service('theme_handler');
         $theme_handler->refreshInfo();
         // @todo This is not needed after https://www.drupal.org/node/2330755
         $list = $theme_handler->listInfo();
         $theme_handler->addTheme($list[$theme_name]);
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_theme_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_theme_warning');
             if (!devel_silent() && $this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme information is being rebuilt on every request. Remember to <a href="@url">turn off</a> this feature on production websites.', array('@url' => $this->urlGenerator->generateFromRoute('devel.admin_settings'))));
             }
         }
     }
     drupal_register_shutdown_function('devel_shutdown');
 }
开发者ID:atif-shaikh,项目名称:DCX-Profile,代码行数:57,代码来源:DevelEventSubscriber.php

示例15: onRequest

 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if ($this->config->get('rebuild_theme')) {
         drupal_theme_rebuild();
         // Ensure that the active theme object is cleared.
         $theme_name = \Drupal::theme()->getActiveTheme()->getName();
         \Drupal::state()->delete('theme.active_theme.' . $theme_name);
         \Drupal::theme()->resetActiveTheme();
         /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
         $theme_handler = \Drupal::service('theme_handler');
         $theme_handler->refreshInfo();
         // @todo This is not needed after https://www.drupal.org/node/2330755
         $list = $theme_handler->listInfo();
         $theme_handler->addTheme($list[$theme_name]);
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_theme_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_theme_warning');
             if ($this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme information is being rebuilt on every request. Remember to <a href=":url">turn off</a> this feature on production websites.', array(':url' => $this->urlGenerator->generateFromRoute('devel.admin_settings'))));
             }
         }
     }
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:25,代码来源:DevelEventSubscriber.php


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