當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityTypeInterface::getBundleLabel方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityTypeInterface::getBundleLabel方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityTypeInterface::getBundleLabel方法的具體用法?PHP EntityTypeInterface::getBundleLabel怎麽用?PHP EntityTypeInterface::getBundleLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityTypeInterface的用法示例。


在下文中一共展示了EntityTypeInterface::getBundleLabel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: bundleLabel

 /**
  * Returns the bundle label for the entity being processed.
  *
  * @return string
  *   The bundle label.
  */
 protected function bundleLabel()
 {
     if ($label = $this->entityType->getBundleLabel()) {
         return $label;
     }
     return $this->t('Bundle');
 }
開發者ID:Tawreh,項目名稱:mtg,代碼行數:13,代碼來源:EntityProcessorBase.php

示例2: summary

 /**
  * {@inheritdoc}
  */
 public function summary()
 {
     if (count($this->configuration['bundles']) > 1) {
         $bundles = $this->configuration['bundles'];
         $last = array_pop($bundles);
         $bundles = implode(', ', $bundles);
         return $this->t('@bundle_type is @bundles or @last', array('@bundle_type' => $this->bundleOf->getBundleLabel(), '@bundles' => $bundles, '@last' => $last));
     }
     $bundle = reset($this->configuration['bundles']);
     return $this->t('@bundle_type is @bundle', array('@bundle_type' => $this->bundleOf->getBundleLabel(), '@bundle' => $bundle));
 }
開發者ID:isramv,項目名稱:camp-gdl,代碼行數:14,代碼來源:EntityBundle.php

示例3: getEntityBundleLabel

 /**
  * Provides the bundle label with a fallback when not defined.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type we are looking the bundle label for.
  *
  * @return \Drupal\Core\StringTranslation\TranslatableMarkup
  *   The entity bundle label or a fallback label.
  */
 protected function getEntityBundleLabel($entity_type)
 {
     if ($label = $entity_type->getBundleLabel()) {
         return $this->t('@label', ['@label' => $label]);
     }
     $fallback = $entity_type->getLabel();
     if ($bundle_entity_type = $entity_type->getBundleEntityType()) {
         // This is a better fallback.
         $fallback = $this->entityManager->getDefinition($bundle_entity_type)->getLabel();
     }
     return $this->t('@label bundle', ['@label' => $fallback]);
 }
開發者ID:Wylbur,項目名稱:gj,代碼行數:21,代碼來源:EntityBundle.php

示例4: getBundleLabel

 /**
  * Returns the bundle label for a given entity type.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type.
  *
  * @return string
  *   The bundle label.
  */
 protected function getBundleLabel(EntityTypeInterface $entity_type)
 {
     if ($entity_type->getBundleLabel()) {
         return $entity_type->getBundleLabel();
     }
     if ($entity_type->getBundleEntityType()) {
         return \Drupal::entityTypeManager()->getDefinition($entity_type->getBundleEntityType())->getLabel();
     }
     return $this->t('@label type', ['@label' => $entity_type->getLabel()]);
 }
開發者ID:andrewl,項目名稱:andrewlnet,代碼行數:19,代碼來源:ContentEntitySource.php

示例5: baseFieldDefinitions

 /**
  * {@inheritdoc}
  */
 public static function baseFieldDefinitions(EntityTypeInterface $entity_type)
 {
     $fields = [];
     if ($entity_type->hasKey('id')) {
         $fields[$entity_type->getKey('id')] = BaseFieldDefinition::create('integer')->setLabel(new TranslatableMarkup('ID'))->setReadOnly(TRUE)->setSetting('unsigned', TRUE);
     }
     if ($entity_type->hasKey('uuid')) {
         $fields[$entity_type->getKey('uuid')] = BaseFieldDefinition::create('uuid')->setLabel(new TranslatableMarkup('UUID'))->setReadOnly(TRUE);
     }
     if ($entity_type->hasKey('revision')) {
         $fields[$entity_type->getKey('revision')] = BaseFieldDefinition::create('integer')->setLabel(new TranslatableMarkup('Revision ID'))->setReadOnly(TRUE)->setSetting('unsigned', TRUE);
     }
     if ($entity_type->hasKey('langcode')) {
         $fields[$entity_type->getKey('langcode')] = BaseFieldDefinition::create('language')->setLabel(new TranslatableMarkup('Language'))->setDisplayOptions('view', ['type' => 'hidden'])->setDisplayOptions('form', ['type' => 'language_select', 'weight' => 2]);
         if ($entity_type->isRevisionable()) {
             $fields[$entity_type->getKey('langcode')]->setRevisionable(TRUE);
         }
         if ($entity_type->isTranslatable()) {
             $fields[$entity_type->getKey('langcode')]->setTranslatable(TRUE);
         }
     }
     if ($entity_type->hasKey('bundle')) {
         if ($bundle_entity_type_id = $entity_type->getBundleEntityType()) {
             $fields[$entity_type->getKey('bundle')] = BaseFieldDefinition::create('entity_reference')->setLabel($entity_type->getBundleLabel())->setSetting('target_type', $bundle_entity_type_id)->setRequired(TRUE)->setReadOnly(TRUE);
         } else {
             $fields[$entity_type->getKey('bundle')] = BaseFieldDefinition::create('string')->setLabel($entity_type->getBundleLabel())->setRequired(TRUE)->setReadOnly(TRUE);
         }
     }
     return $fields;
 }
開發者ID:318io,項目名稱:318-io,代碼行數:33,代碼來源:ContentEntityBase.php


注:本文中的Drupal\Core\Entity\EntityTypeInterface::getBundleLabel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。