return new static($plugin_id,
$plugin_definition,
$configuration['field_definition'
],
$configuration['settings'
],
$configuration['label'
],
$configuration['view_mode'
],
$configuration['third_party_settings'
]);
} /**
* {@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 =
[ '#theme' => 'field',
'#title' =>
$this->fieldDefinition->
getLabel(),
'#label_display' =>
$this->label,