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


PHP ConfigEntityInterface::label方法代码示例

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


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

示例1: overviewRow

 /**
  * Builds a table row for overview form.
  *
  * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
  *   Data needed to build the list row.
  *
  * @return array
  *   A single table row for the overview.
  */
 public function overviewRow(ConfigEntityInterface $entity)
 {
     $label = $entity->label() ?: $this->t('@type: @id', array('@type' => $entity->getEntityTypeId(), '@id' => $entity->id()));
     // Get current job items for the entity to determine translation statuses.
     $source_lang = $entity->language()->getId();
     $current_job_items = tmgmt_job_item_load_latest('config', $entity->getEntityTypeId(), $entity->getConfigDependencyName(), $source_lang);
     $row['id'] = $entity->id();
     $definition = \Drupal::entityTypeManager()->getDefinition($entity->bundle());
     $row['config_id'] = $definition->getConfigPrefix() . '.' . $entity->id();
     if ($entity->hasLinkTemplate('edit-form')) {
         $row['title'] = $entity->toLink($label, 'edit-form');
     } else {
         // If the entity doesn't have a link we display a label.
         $row['title'] = $label;
     }
     // Load entity translation specific data.
     foreach (\Drupal::languageManager()->getLanguages() as $langcode => $language) {
         $translation_status = 'current';
         if ($langcode == $source_lang) {
             $translation_status = 'original';
         } elseif (!$this->isTranslated($langcode, $entity->getConfigDependencyName())) {
             $translation_status = 'missing';
         }
         // @todo Find a way to support marking configuration translations as outdated.
         $build = $this->buildTranslationStatus($translation_status, isset($current_job_items[$langcode]) ? $current_job_items[$langcode] : NULL);
         $row['langcode-' . $langcode] = ['data' => \Drupal::service('renderer')->render($build), 'class' => array('langstatus-' . $langcode)];
     }
     return $row;
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:38,代码来源:ConfigSourcePluginUi.php

示例2: getTitle

 /**
  * {@inheritdoc}
  */
 public function getTitle()
 {
     // Title based on the entity label. Should be translated for display in the
     // current page language. The title placeholder is later escaped for
     // display.
     $entity_type_info = $this->entityManager->getDefinition($this->entityType);
     return $this->t($this->pluginDefinition['title'], array('!label' => $this->entity->label(), '!entity_type' => $entity_type_info->getLowercaseLabel()));
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:11,代码来源:ConfigEntityMapper.php

示例3: sort

 /**
  * {@inheritdoc}
  */
 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
 {
     if ($a->isLocked() == $b->isLocked()) {
         $a_label = $a->label();
         $b_label = $b->label();
         return strnatcasecmp($a_label, $b_label);
     }
     return $a->isLocked() ? 1 : -1;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:12,代码来源:DateFormat.php

示例4: sort

 /**
  * Helper callback for uasort() to sort configuration entities by weight and label.
  */
 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
 {
     $a_weight = isset($a->weight) ? $a->weight : 0;
     $b_weight = isset($b->weight) ? $b->weight : 0;
     if ($a_weight == $b_weight) {
         $a_label = $a->label();
         $b_label = $b->label();
         return strnatcasecmp($a_label, $b_label);
     }
     return $a_weight < $b_weight ? -1 : 1;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:14,代码来源:ConfigEntityBase.php

示例5: getTitle

 /**
  * {@inheritdoc}
  */
 public function getTitle()
 {
     return $this->entity->label() . ' ' . $this->pluginDefinition['title'];
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:7,代码来源:ConfigEntityMapper.php

示例6: sort

 /**
  * Sorts active blocks by weight; sorts inactive blocks by name.
  */
 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
 {
     // Separate enabled from disabled.
     $status = (int) $b->status() - (int) $a->status();
     if ($status !== 0) {
         return $status;
     }
     // Sort by weight, unless disabled.
     if ($a->getRegion() != static::BLOCK_REGION_NONE) {
         $weight = $a->getWeight() - $b->getWeight();
         if ($weight) {
             return $weight;
         }
     }
     // Sort by label.
     return strcmp($a->label(), $b->label());
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:20,代码来源:Block.php

示例7: sort

 /**
  * Sorts active blocks by weight; sorts inactive blocks by name.
  */
 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
 {
     // Separate enabled from disabled.
     $status = $b->get('status') - $a->get('status');
     if ($status) {
         return $status;
     }
     // Sort by weight, unless disabled.
     if ($a->get('region') != static::BLOCK_REGION_NONE) {
         $weight = $a->get('weight') - $b->get('weight');
         if ($weight) {
             return $weight;
         }
     }
     // Sort by label.
     return strcmp($a->label(), $b->label());
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:20,代码来源:Block.php


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