You are here

protected function TransactionDescriptionItemList::ensurePopulated in Transaction 8

Calculates the value of the item list and sets it.

3 calls to TransactionDescriptionItemList::ensurePopulated()
TransactionDescriptionItemList::getIterator in src/Plugin/Field/TransactionDescriptionItemList.php
TransactionDescriptionItemList::getValue in src/Plugin/Field/TransactionDescriptionItemList.php
Gets the data value.
TransactionDescriptionItemList::isEmpty in src/Plugin/Field/TransactionDescriptionItemList.php
Determines whether the list contains any non-empty items.

File

src/Plugin/Field/TransactionDescriptionItemList.php, line 46

Class

TransactionDescriptionItemList
Item list for a computed field that displays the transaction description.

Namespace

Drupal\transaction\Plugin\Field

Code

protected function ensurePopulated() {
  if (!isset($this->list[0])) {

    /** @var \Drupal\transaction\TransactionInterface $entity */
    $entity = $this
      ->getEntity();
    $this->list[0] = $this
      ->createItem(0, $entity
      ->isNew() ? '' : $entity
      ->getDescription(TRUE));
  }
}