You are here

protected function MinisiteItemList::getOriginalItemsList in Mini site 8

Get original item list for the current instance.

Return value

null|\Drupal\Core\Field\FieldItemList The original item list for the same language as the current item list or NULL if the item list for the same language does not exist.

1 call to MinisiteItemList::getOriginalItemsList()
MinisiteItemList::postSave in src/Plugin/Field/FieldType/MinisiteItemList.php
Defines custom post-save behavior for field values.

File

src/Plugin/Field/FieldType/MinisiteItemList.php, line 57

Class

MinisiteItemList
Class MinisiteItemList.

Namespace

Drupal\minisite\Plugin\Field\FieldType

Code

protected function getOriginalItemsList() {
  $entity = $this
    ->getEntity();
  $original = $entity->original;
  $field_name = $this
    ->getFieldDefinition()
    ->getName();
  $langcode = $this
    ->getLangcode();
  if (!$original || !$original
    ->hasTranslation($langcode)) {
    return NULL;
  }
  return $original
    ->getTranslation($langcode)->{$field_name};
}