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


PHP FieldDefinitionInterface::isTranslatable方法代碼示例

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


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

示例1: view

 /**
  * {@inheritdoc}
  */
 public function view(FieldItemListInterface $items, $langcode = NULL)
 {
     // Default the language to the current content language.
     if (empty($langcode)) {
         $langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
     }
     $elements = $this->viewElements($items, $langcode);
     // If there are actual renderable children, use #theme => field, otherwise,
     // let access cacheability metadata pass through for correct bubbling.
     if (Element::children($elements)) {
         $entity = $items->getEntity();
         $entity_type = $entity->getEntityTypeId();
         $field_name = $this->fieldDefinition->getName();
         $info = array('#theme' => 'field', '#title' => $this->fieldDefinition->getLabel(), '#label_display' => $this->label, '#view_mode' => $this->viewMode, '#language' => $items->getLangcode(), '#field_name' => $field_name, '#field_type' => $this->fieldDefinition->getType(), '#field_translatable' => $this->fieldDefinition->isTranslatable(), '#entity_type' => $entity_type, '#bundle' => $entity->bundle(), '#object' => $entity, '#items' => $items, '#formatter' => $this->getPluginId(), '#is_multiple' => $this->fieldDefinition->getFieldStorageDefinition()->isMultiple());
         $elements = array_merge($info, $elements);
     }
     return $elements;
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:21,代碼來源:FormatterBase.php

示例2: view

 /**
  * {@inheritdoc}
  */
 public function view(FieldItemListInterface $items)
 {
     $addition = array();
     $elements = $this->viewElements($items);
     if ($elements) {
         $entity = $items->getEntity();
         $entity_type = $entity->getEntityTypeId();
         $field_name = $this->fieldDefinition->getName();
         $info = array('#theme' => 'field', '#title' => $this->fieldDefinition->getLabel(), '#label_display' => $this->label, '#view_mode' => $this->viewMode, '#language' => $items->getLangcode(), '#field_name' => $field_name, '#field_type' => $this->fieldDefinition->getType(), '#field_translatable' => $this->fieldDefinition->isTranslatable(), '#entity_type' => $entity_type, '#bundle' => $entity->bundle(), '#object' => $entity, '#items' => $items, '#formatter' => $this->getPluginId());
         $addition = array_merge($info, $elements);
     }
     return $addition;
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:16,代碼來源:FormatterBase.php

示例3: view

 /**
  * {@inheritdoc}
  */
 public function view(FieldItemListInterface $items)
 {
     $elements = $this->viewElements($items);
     // If there are actual renderable children, use #theme => field, otherwise,
     // let access cacheability metadata pass through for correct bubbling.
     if (Element::children($elements)) {
         $entity = $items->getEntity();
         $entity_type = $entity->getEntityTypeId();
         $field_name = $this->fieldDefinition->getName();
         $info = array('#theme' => 'field', '#title' => $this->fieldDefinition->getLabel(), '#label_display' => $this->label, '#view_mode' => $this->viewMode, '#language' => $items->getLangcode(), '#field_name' => $field_name, '#field_type' => $this->fieldDefinition->getType(), '#field_translatable' => $this->fieldDefinition->isTranslatable(), '#entity_type' => $entity_type, '#bundle' => $entity->bundle(), '#object' => $entity, '#items' => $items, '#formatter' => $this->getPluginId());
         $elements = array_merge($info, $elements);
     }
     return $elements;
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:17,代碼來源:FormatterBase.php


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