当前位置: 首页>>代码示例>>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;未经允许,请勿转载。