public function LingotekContentMetadataFieldItemList::get in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 4.0.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.0.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.1.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.2.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.4.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.5.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.6.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.7.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
- 3.8.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::get()
Returns the item at the specified position in this list.
Parameters
int $index: Index of the item to return.
Return value
\Drupal\Core\TypedData\TypedDataInterface|null The item at the specified position in this list, or NULL if no item exists at that position.
Throws
\Drupal\Core\TypedData\Exception\MissingDataException If the complex data structure is unset and no item can be created.
Overrides ItemList::get
File
- src/
Plugin/ Field/ LingotekContentMetadataFieldItemList.php, line 53
Class
- LingotekContentMetadataFieldItemList
- A computed field that provides a content entity's Lingotek metadata.
Namespace
Drupal\lingotek\Plugin\FieldCode
public function get($index) {
if ($index !== 0) {
throw new \InvalidArgumentException('An entity can not have multiple moderation states at the same time.');
}
if (isset($this->list[$index]) && !$this->list[$index]
->isEmpty()) {
return $this->list[$index];
}
$this
->computeLingotekMetadataFieldItemList();
return isset($this->list[$index]) ? $this->list[$index] : NULL;
}