You are here

protected function LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  2. 3.0.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  3. 3.1.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  4. 3.2.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  5. 3.3.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  6. 3.4.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  7. 3.5.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  8. 3.6.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  9. 3.7.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
  10. 3.8.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()

Recalculate the Lingotek metadata field item list.

2 calls to LingotekContentMetadataFieldItemList::computeLingotekMetadataFieldItemList()
LingotekContentMetadataFieldItemList::get in src/Plugin/Field/LingotekContentMetadataFieldItemList.php
Returns the item at the specified position in this list.
LingotekContentMetadataFieldItemList::getIterator in src/Plugin/Field/LingotekContentMetadataFieldItemList.php

File

src/Plugin/Field/LingotekContentMetadataFieldItemList.php, line 75

Class

LingotekContentMetadataFieldItemList
A computed field that provides a content entity's Lingotek metadata.

Namespace

Drupal\lingotek\Plugin\Field

Code

protected function computeLingotekMetadataFieldItemList() {

  // Compute the value of the moderation state.
  $index = 0;
  if (!isset($this->list[$index]) || $this->list[$index]
    ->isEmpty()) {
    $metadata = $this
      ->getContentMetadata();

    // Do not store NULL values in the static cache.
    if ($metadata) {
      $this->list[$index] = $this
        ->createItem($index, [
        'entity' => $metadata,
      ]);
    }
  }
}