• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Core\Link类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: viewElements

 /**
  * {@inheritdoc}
  */
 public function viewElements(FieldItemListInterface $items, $langcode)
 {
     $elements = [];
     \Drupal::logger('tec_formatters')->notice('HOOLA');
     foreach ($items as $delta => $item) {
         $url = Url::fromUri('mailto:' . $this->viewValue($item), array('absolute' => TRUE));
         $link = new Link('Send email', $url);
         $elements[$delta] = $link->toRenderable();
     }
     return $elements;
 }
开发者ID:kporras07,项目名称:tec_formatters,代码行数:14,代码来源:TecFieldFormatter.php


示例2: render

 /**
  * Adds some descriptive text to our entity list.
  *
  * @return array
  *   Renderable array.
  */
 public function render()
 {
     $build['description'] = array('#markup' => $this->t("<p>This is a list of the countries currently" . " defined for use on your Drupal site. This country data adheres to" . " the @iso standard for country and zone naming used by payment" . " providers and package couriers.</p>" . "<p>To make a country available for use at checkout or in a user's" . " address book, 'Enable' the country using the widget in the" . " 'Operations' for that country. You may also 'Disable' a country to" . " prevent customers from selecting that country as a billing or" . " shipping address.</p>" . "<p>You may also use the 'Edit' widget in the 'Operations' column to" . " edit a country's name or address format.</p>", ['@iso' => Link::fromTextAndUrl('ISO 3166', Url::fromUri('http://en.wikipedia.org/wiki/ISO_3166'))->toString()]));
     $build += parent::render();
     $build['table']['#empty'] = $this->t('No countries have been configured yet.');
     return $build;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:13,代码来源:CountryListBuilder.php


示例3: build

 /**
  * {@inheritdoc}
  */
 public function build()
 {
     $options = array('attributes' => array('title' => $this->link_label()));
     return array('#type' => 'link', '#title' => $this->link_label(), '#url' => new Url('happy_alexandrie.query_welcome_controller', array(), $options), '#prefix' => '<p>', '#suffix' => '</p>');
     // Other ways to do it. Directly using the link element.
     return [Link::createFromRoute($this->configuration['link_title'], 'happy_alexandrie.query_welcome_controller')->toRenderable()];
 }
开发者ID:Happyculture,项目名称:exercices,代码行数:10,代码来源:LibraryBlock.php


示例4: orphans

 /**
  * Displays links to all products that have not been categorized.
  *
  * @return
  *   Renderable form array.
  */
 public function orphans()
 {
     $build = array();
     if ($this->config('taxonomy.settings')->get('maintain_index_table')) {
         $vid = $this->config('uc_catalog.settings')->get('vocabulary');
         $product_types = uc_product_types();
         $field = FieldStorageConfig::loadByName('node', 'taxonomy_catalog');
         //@todo - figure this out
         // $field is a config object, not an array, so this doesn't work.
         //$types = array_intersect($product_types, $field['bundles']['node']);
         $types = $product_types;
         //temporary to get this to work at all
         $result = db_query('SELECT DISTINCT n.nid, n.title FROM {node_field_data} n LEFT JOIN (SELECT ti.nid, td.vid FROM {taxonomy_index} ti LEFT JOIN {taxonomy_term_data} td ON ti.tid = td.tid WHERE td.vid = :vid) txnome ON n.nid = txnome.nid WHERE n.type IN (:types[]) AND txnome.vid IS NULL', [':vid' => $vid, ':types[]' => $types]);
         $rows = array();
         while ($node = $result->fetchObject()) {
             $rows[] = Link::createFromRoute($node->title, 'entity.node.edit_form', ['node' => $node->nid], ['query' => ['destination' => 'admin/store/products/orphans']])->toString();
         }
         if (count($rows) > 0) {
             $build['orphans'] = array('#theme' => 'item_list', '#items' => $rows);
         } else {
             $build['orphans'] = array('#markup' => $this->t('All products are currently listed in the catalog.'), '#prefix' => '<p>', '#suffix' => '</p>');
         }
     } else {
         $build['orphans'] = array('#markup' => $this->t('The node terms index is not being maintained, so Ubercart can not determine which products are not entered into the catalog.'), '#prefix' => '<p>', '#suffix' => '</p>');
     }
     return $build;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:33,代码来源:CatalogAdminController.php


示例5: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = new Breadcrumb();
     $breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
     $term = $route_match->getParameter('taxonomy_term');
     // Breadcrumb needs to have terms cacheable metadata as a cacheable
     // dependency even though it is not shown in the breadcrumb because e.g. its
     // parent might have changed.
     $breadcrumb->addCacheableDependency($term);
     // @todo This overrides any other possible breadcrumb and is a pure
     //   hard-coded presumption. Make this behavior configurable per
     //   vocabulary or term.
     $parents = $this->termStorage->loadAllParents($term->id());
     // Remove current term being accessed.
     array_shift($parents);
     foreach (array_reverse($parents) as $term) {
         $term = $this->entityManager->getTranslationFromContext($term);
         $breadcrumb->addCacheableDependency($term);
         $breadcrumb->addLink(Link::createFromRoute($term->getName(), 'entity.taxonomy_term.canonical', array('taxonomy_term' => $term->id())));
     }
     // This breadcrumb builder is based on a route parameter, and hence it
     // depends on the 'route' cache context.
     $breadcrumb->addCacheContexts(['route']);
     return $breadcrumb;
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:28,代码来源:TermBreadcrumbBuilder.php


示例6: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb[] = Link::createFromRoute($this->t('Home'), '<front>');
     $vocabulary = $this->entityManager->getStorage('taxonomy_vocabulary')->load($this->config->get('vocabulary'));
     $breadcrumb[] = Link::createFromRoute($vocabulary->label(), 'forum.index');
     return $breadcrumb;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:10,代码来源:ForumBreadcrumbBuilderBase.php


示例7: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $book_nids = array();
     $breadcrumb = new Breadcrumb();
     $links = array(Link::createFromRoute($this->t('Home'), '<front>'));
     $book = $route_match->getParameter('node')->book;
     $depth = 1;
     // We skip the current node.
     while (!empty($book['p' . ($depth + 1)])) {
         $book_nids[] = $book['p' . $depth];
         $depth++;
     }
     $parent_books = $this->nodeStorage->loadMultiple($book_nids);
     if (count($parent_books) > 0) {
         $depth = 1;
         while (!empty($book['p' . ($depth + 1)])) {
             if (!empty($parent_books[$book['p' . $depth]]) && ($parent_book = $parent_books[$book['p' . $depth]])) {
                 $access = $parent_book->access('view', $this->account, TRUE);
                 $breadcrumb->addCacheableDependency($access);
                 if ($access->isAllowed()) {
                     $breadcrumb->addCacheableDependency($parent_book);
                     $links[] = Link::createFromRoute($parent_book->label(), 'entity.node.canonical', array('node' => $parent_book->id()));
                 }
             }
             $depth++;
         }
     }
     $breadcrumb->setLinks($links);
     $breadcrumb->addCacheContexts(['route.book_navigation']);
     return $breadcrumb;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:34,代码来源:BookBreadcrumbBuilder.php


示例8: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $enabled_link = Link::fromTextAndUrl(t('enabled'), Url::fromRoute('system.modules_list'));
     $form['#attached']['library'][] = 'system/drupal.system';
     $form['exclude_node_title_search'] = ['#type' => 'checkbox', '#title' => $this->t('Remove node title from search pages'), '#description' => $this->t('Select if you wish to remove title from search pages. You need to have Search module @link.', ['@link' => $enabled_link]), '#default_value' => $this->excludeNodeTitleManager->isSearchExcluded(), '#disabled' => !\Drupal::moduleHandler()->moduleExists('search')];
     $form['content_type'] = ['#type' => 'fieldset', '#title' => $this->t('Exclude title by content types'), '#description' => $this->t('Define title excluding settings for each content type.'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE];
     foreach ($this->bundleInfo->getBundleInfo('node') as $node_type => $node_type_info) {
         $form['#attached']['drupalSettings']['exclude_node_title']['content_types'][$node_type] = $node_type_info['label'];
         $form['content_type'][$node_type]['content_type_value'] = ['#type' => 'select', '#title' => $node_type_info['label'], '#default_value' => $this->excludeNodeTitleManager->getBundleExcludeMode($node_type), '#options' => ['none' => $this->t('None'), 'all' => $this->t('All nodes...'), 'user' => $this->t('User defined nodes...')]];
         $entity_view_modes = $this->entityDisplayRepository->getViewModes('node');
         $modes = [];
         foreach ($entity_view_modes as $view_mode_name => $view_mode_info) {
             $modes[$view_mode_name] = $view_mode_info['label'];
         }
         $modes += ['nodeform' => $this->t('Node form')];
         switch ($form['content_type'][$node_type]['content_type_value']['#default_value']) {
             case 'all':
                 $title = $this->t('Exclude title from all nodes in the following view modes:');
                 break;
             case 'user defined':
                 $title = $this->t('Exclude title from user defined nodes in the following view modes:');
                 break;
             default:
                 $title = $this->t('Exclude from:');
         }
         $form['content_type'][$node_type]['content_type_modes'] = ['#type' => 'checkboxes', '#title' => $title, '#default_value' => $this->excludeNodeTitleManager->getExcludedViewModes($node_type), '#options' => $modes, '#states' => ['invisible' => ['select[name="content_type[' . $node_type . '][content_type_value]"]' => ['value' => 'none']]]];
     }
     $form['#attached']['library'][] = 'exclude_node_title/drupal.exclude_node_title.admin';
     return parent::buildForm($form, $form_state);
 }
开发者ID:seongbae,项目名称:AsianChamber-Web,代码行数:33,代码来源:ExcludeNodeTitleAdminSettingsForm.php


示例9: view

 /**
  * {@inheritdoc}
  */
 public function view(OrderInterface $order, $view_mode)
 {
     $build = array('#type' => 'table', '#attributes' => array('class' => array('order-pane-table')), '#header' => array('qty' => array('data' => $this->t('Quantity'), 'class' => array('qty')), 'product' => array('data' => $this->t('Product'), 'class' => array('product')), 'model' => array('data' => $this->t('SKU'), 'class' => array('sku', RESPONSIVE_PRIORITY_LOW)), 'cost' => array('data' => $this->t('Cost'), 'class' => array('cost', RESPONSIVE_PRIORITY_LOW)), 'price' => array('data' => $this->t('Price'), 'class' => array('price')), 'total' => array('data' => $this->t('Total'), 'class' => array('price'))), '#empty' => $this->t('This order contains no products.'));
     $account = \Drupal::currentUser();
     if (!$account->hasPermission('administer products')) {
         unset($build['#header']['cost']);
     }
     // @todo Replace with Views.
     foreach ($order->products as $id => $product) {
         $build[$id]['qty'] = array('#theme' => 'uc_qty', '#qty' => $product->qty->value, '#cell_attributes' => array('class' => array('qty')));
         if ($product->nid->entity && $product->nid->entity->access('view')) {
             $title = Link::createFromRoute($product->title->value, 'entity.node.canonical', ['node' => $product->nid->target_id])->toString();
         } else {
             $title = $product->title->value;
         }
         $build[$id]['product'] = array('#markup' => $title . uc_product_get_description($product), '#cell_attributes' => array('class' => array('product')));
         $build[$id]['model'] = array('#markup' => $product->model->value, '#cell_attributes' => array('class' => array('sku')));
         if ($account->hasPermission('administer products')) {
             $build[$id]['cost'] = array('#theme' => 'uc_price', '#price' => $product->cost->value, '#cell_attributes' => array('class' => array('cost')));
         }
         $build[$id]['price'] = array('#theme' => 'uc_price', '#price' => $product->price->value, '#suffixes' => array(), '#cell_attributes' => array('class' => array('price')));
         $build[$id]['total'] = array('#theme' => 'uc_price', '#price' => $product->price->value * $product->qty->value, '#suffixes' => array(), '#cell_attributes' => array('class' => array('total')));
         //      $build[$id][$field]['#wrapper_attributes']['class'] = $build['#header'][$field]['class'];
     }
     return $build;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:29,代码来源:Products.php


示例10: testBuild

 /**
  * Tests ForumBreadcrumbBuilderBase::build().
  *
  * @see \Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase::build()
  *
  * @covers ::build
  */
 public function testBuild()
 {
     // Build all our dependencies, backwards.
     $forum_manager = $this->getMockBuilder('Drupal\\forum\\ForumManagerInterface')->disableOriginalConstructor()->getMock();
     $prophecy = $this->prophesize('Drupal\\taxonomy\\VocabularyInterface');
     $prophecy->label()->willReturn('Fora_is_the_plural_of_forum');
     $prophecy->id()->willReturn(5);
     $prophecy->getCacheTags()->willReturn(['taxonomy_vocabulary:5']);
     $prophecy->getCacheContexts()->willReturn([]);
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
     $vocab_storage = $this->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
     $vocab_storage->expects($this->any())->method('load')->will($this->returnValueMap(array(array('forums', $prophecy->reveal()))));
     $entity_manager = $this->getMockBuilder('Drupal\\Core\\Entity\\EntityManagerInterface')->disableOriginalConstructor()->getMock();
     $entity_manager->expects($this->any())->method('getStorage')->will($this->returnValueMap(array(array('taxonomy_vocabulary', $vocab_storage))));
     $config_factory = $this->getConfigFactoryStub(array('forum.settings' => array('vocabulary' => 'forums')));
     // Build a breadcrumb builder to test.
     $breadcrumb_builder = $this->getMockForAbstractClass('Drupal\\forum\\Breadcrumb\\ForumBreadcrumbBuilderBase', array($entity_manager, $config_factory, $forum_manager));
     // Add a translation manager for t().
     $translation_manager = $this->getStringTranslationStub();
     $breadcrumb_builder->setStringTranslation($translation_manager);
     // Our empty data set.
     $route_match = $this->getMock('Drupal\\Core\\Routing\\RouteMatchInterface');
     // Expected result set.
     $expected = array(Link::createFromRoute('Home', '<front>'), Link::createFromRoute('Fora_is_the_plural_of_forum', 'forum.index'));
     // And finally, the test.
     $breadcrumb = $breadcrumb_builder->build($route_match);
     $this->assertEquals($expected, $breadcrumb->getLinks());
     $this->assertEquals(['route'], $breadcrumb->getCacheContexts());
     $this->assertEquals(['taxonomy_vocabulary:5'], $breadcrumb->getCacheTags());
     $this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
 }
开发者ID:shawnmmatthews,项目名称:gerber8,代码行数:38,代码来源:ForumBreadcrumbBuilderBaseTest.php


示例11: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $book_nids = array();
     $links = array(Link::createFromRoute($this->t('Home'), '<front>'));
     $book = $route_match->getParameter('node')->book;
     $depth = 1;
     // We skip the current node.
     while (!empty($book['p' . ($depth + 1)])) {
         $book_nids[] = $book['p' . $depth];
         $depth++;
     }
     $parent_books = $this->nodeStorage->loadMultiple($book_nids);
     if (count($parent_books) > 0) {
         $depth = 1;
         while (!empty($book['p' . ($depth + 1)])) {
             if (!empty($parent_books[$book['p' . $depth]]) && ($parent_book = $parent_books[$book['p' . $depth]])) {
                 if ($parent_book->access('view', $this->account)) {
                     $links[] = Link::createFromRoute($parent_book->label(), 'entity.node.canonical', array('node' => $parent_book->id()));
                 }
             }
             $depth++;
         }
     }
     return $links;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:28,代码来源:BookBreadcrumbBuilder.php


示例12: form

 /**
  * {@inheritdoc}
  */
 public function form(array $form, FormStateInterface $form_state)
 {
     $form = parent::form($form, $form_state);
     /** @var \Drupal\commerce_tax\Entity\TaxTypeInterface $tax_type */
     $tax_type = $this->entity;
     /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $zone_storage */
     $zone_storage = $this->entityTypeManager->getStorage('zone');
     $zones = $zone_storage->loadMultipleOverrideFree();
     // @todo Filter by zone scope == 'tax'.
     $zones = array_map(function ($zone) {
         return $zone->label();
     }, $zones);
     $form['name'] = ['#type' => 'textfield', '#title' => $this->t('Name'), '#default_value' => $tax_type->getName(), '#maxlength' => 255, '#required' => TRUE];
     $form['id'] = ['#type' => 'machine_name', '#title' => $this->t('Machine name'), '#default_value' => $tax_type->getId(), '#machine_name' => ['exists' => '\\Drupal\\commerce_tax\\Entity\\TaxType::load', 'source' => ['name']], '#required' => TRUE, '#disabled' => !$tax_type->isNew()];
     $form['zone'] = ['#type' => 'select', '#title' => $this->t('Zone'), '#default_value' => $tax_type->getZoneId(), '#options' => $zones, '#required' => TRUE];
     if ($tax_type->isNew()) {
         $link = Link::createFromRoute('Zones page', 'entity.zone.collection')->toString();
         $form['zone']['#description'] = $this->t('To add a new zone visit the @link.', ['@link' => $link]);
     }
     $form['compound'] = ['#type' => 'checkbox', '#title' => $this->t('Compound'), '#description' => $this->t("Compound tax is calculated on top of a primary tax. For example, Canada's Provincial Sales Tax (PST) is compound, calculated on a price that already includes the Goods and Services Tax (GST)."), '#default_value' => $tax_type->isCompound()];
     $form['displayInclusive'] = ['#type' => 'checkbox', '#title' => $this->t('Display inclusive'), '#default_value' => $tax_type->isDisplayInclusive()];
     $form['roundingMode'] = ['#type' => 'radios', '#title' => $this->t('Rounding mode'), '#default_value' => $tax_type->getRoundingMode() ?: TaxType::ROUND_HALF_UP, '#options' => [TaxType::ROUND_HALF_UP => $this->t('Round up'), TaxType::ROUND_HALF_DOWN => $this->t('Round down'), TaxType::ROUND_HALF_EVEN => $this->t('Round even'), TaxType::ROUND_HALF_ODD => $this->t('Round odd')], '#required' => TRUE];
     $form['tag'] = ['#type' => 'textfield', '#title' => $this->t('Tag'), '#description' => $this->t('Used by the resolvers to analyze only the tax types relevant to them. For example, the EuTaxTypeResolver would analyze only the tax types with the "EU" tag.'), '#default_value' => $tax_type->getTag()];
     return $form;
 }
开发者ID:alexburrows,项目名称:cream-2.x,代码行数:28,代码来源:TaxTypeForm.php


示例13: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = array();
     $breadcrumb[] = Link::createFromRoute($this->t('Home'), '<front>');
     $entity = $route_match->getParameter('entity');
     $breadcrumb[] = new Link($entity->label(), $entity->urlInfo());
     return $breadcrumb;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:11,代码来源:CommentBreadcrumbBuilder.php


示例14: build

 /**
  * @inheritdoc
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = new Breadcrumb();
     $geocoder = $route_match->getParameter('service');
     $current_route = $route_match->getRouteName();
     $links = [Link::createFromRoute($this->t('Home'), '<front>'), Link::createFromRoute($this->t('Administration'), 'system.admin'), Link::createFromRoute($this->t('Configuration'), 'system.admin_config'), Link::createFromRoute($this->t('Dmaps'), 'dmaps.settings'), Link::createFromRoute($this->t('Geocoding'), 'dmaps.locations.geocoding_options'), Link::createFromRoute($this->t('Geocoding %service', ['%service' => $geocoder]), $current_route, ['iso' => $route_match->getParameter('iso'), 'service' => $geocoder])];
     $breadcrumb->setLinks($links);
     return $breadcrumb;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:AdminPagesGeocoderBreadcrumbBuilder.php


示例15: buildConfigurationForm

 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form['wps_email'] = array('#type' => 'email', '#title' => $this->t('PayPal e-mail address'), '#description' => $this->t('The e-mail address you use for the PayPal account you want to receive payments.'), '#default_value' => $this->configuration['wps_email']);
     $form['wpp_server'] = array('#type' => 'select', '#title' => $this->t('API server'), '#description' => $this->t('Sign up for and use a Sandbox account for testing.'), '#options' => array('https://api-3t.sandbox.paypal.com/nvp' => $this->t('Sandbox'), 'https://api-3t.paypal.com/nvp' => $this->t('Live')), '#default_value' => $this->configuration['wpp_server']);
     $form['api'] = array('#type' => 'details', '#title' => $this->t('API credentials'), '#description' => $this->t('@link for information on obtaining credentials.  You need to acquire an API Signature.  If you have already requested API credentials, you can review your settings under the API Access section of your PayPal profile.', ['@link' => Link::fromTextAndUrl($this->t('Click here'), Url::fromUri('https://developer.paypal.com/docs/classic/api/apiCredentials/'))->toString()]), '#open' => TRUE);
     $form['api']['api_username'] = array('#type' => 'textfield', '#title' => $this->t('API username'), '#default_value' => $this->configuration['api']['api_username']);
     $form['api']['api_password'] = array('#type' => 'textfield', '#title' => $this->t('API password'), '#default_value' => $this->configuration['api']['api_password']);
     $form['api']['api_signature'] = array('#type' => 'textfield', '#title' => $this->t('Signature'), '#default_value' => $this->configuration['api']['api_signature']);
     return $form;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:13,代码来源:PayPalPaymentMethodPluginBase.php


示例16: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = new Breadcrumb();
     $links[] = Link::createFromRoute(t('Home'), '<front>');
     // Articles page is a view.
     $links[] = Link::createFromRoute(t('Articles'), 'view.articles.page_1');
     $links[] = Link::createFromRoute($this->node->label(), '<none>');
     $breadcrumb->setLinks($links);
     return $breadcrumb;
 }
开发者ID:chi-teck,项目名称:drupal-code-generator,代码行数:13,代码来源:_breadcrumb_builder.php


示例17: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $config = \Drupal::config('uc_cart.settings');
     $text = $config->get('breadcrumb_text');
     $links[] = Link::createFromRoute($this->t('Home'), '<front>');
     $links[] = new Link($text, Url::fromUri('internal:/' . $config->get('breadcrumb_url'), ['absolute' => TRUE]));
     $breadcrumb = new Breadcrumb();
     $breadcrumb->setLinks($links);
     return $breadcrumb;
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:13,代码来源:CartBreadcrumbBuilder.php


示例18: build

 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = new Breadcrumb();
     $breadcrumb->addCacheContexts(['route']);
     $links[] = Link::createFromRoute($this->t('Home'), '<front>');
     $vocabulary = $this->entityManager->getStorage('taxonomy_vocabulary')->load($this->config->get('vocabulary'));
     $breadcrumb->addCacheableDependency($vocabulary);
     $links[] = Link::createFromRoute($vocabulary->label(), 'forum.index');
     return $breadcrumb->setLinks($links);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:ForumBreadcrumbBuilderBase.php


示例19: listTopics

 /**
  * {@inheritdoc}
  */
 public function listTopics()
 {
     $topics = [];
     foreach ($this->moduleHandler->getImplementations('help') as $module) {
         $title = $this->moduleHandler->getName($module);
         $topics[$title] = Link::createFromRoute($title, 'help.page', ['name' => $module]);
     }
     // Sort topics by title, which is the array key above.
     ksort($topics);
     return $topics;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:14,代码来源:HookHelpSection.php


示例20: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form['id'] = array('#type' => 'textfield', '#title' => $this->t('Order status ID'), '#description' => $this->t('Must be a unique ID with no spaces.'), '#size' => 32, '#maxlength' => 32, '#required' => TRUE);
     $form['name'] = array('#type' => 'textfield', '#title' => $this->t('Title'), '#description' => $this->t('The order status title displayed to users.'), '#size' => 32, '#maxlength' => 48, '#required' => TRUE);
     $form['state'] = array('#type' => 'select', '#title' => $this->t('Order state'), '#description' => $this->t('Set which order state this status is for.'), '#options' => uc_order_state_options_list(), '#default_value' => 'post_checkout');
     $form['weight'] = array('#type' => 'weight', '#title' => $this->t('List position'), '#delta' => 20, '#default_value' => 0);
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['create'] = array('#type' => 'submit', '#value' => $this->t('Create'));
     $form['actions']['cancel'] = array('#markup' => Link::createFromRoute($this->t('Cancel'), 'uc_order.status_add')->toString());
     return $form;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:14,代码来源:OrderStatusAddForm.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Core\Url类代码示例发布时间:2022-05-23
下一篇:
PHP Core\DrupalKernel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap