TransactionDescriptionItemList.php in Transaction 8
File
src/Plugin/Field/TransactionDescriptionItemList.php
View source
<?php
namespace Drupal\transaction\Plugin\Field;
use Drupal\Core\Field\FieldItemList;
class TransactionDescriptionItemList extends FieldItemList {
public function getIterator() {
$this
->ensurePopulated();
return new \ArrayIterator($this->list);
}
public function getValue($include_computed = FALSE) {
$this
->ensurePopulated();
return parent::getValue($include_computed);
}
public function isEmpty() {
$this
->ensurePopulated();
return parent::isEmpty();
}
public function setValue($values, $notify = TRUE) {
}
protected function ensurePopulated() {
if (!isset($this->list[0])) {
$entity = $this
->getEntity();
$this->list[0] = $this
->createItem(0, $entity
->isNew() ? '' : $entity
->getDescription(TRUE));
}
}
}