You are here

FlaggedEntityFieldItemList.php in Flag 8.4

File

src/Plugin/Field/FlaggedEntityFieldItemList.php
View source
<?php

namespace Drupal\flag\Plugin\Field;

use Drupal\Core\Field\EntityReferenceFieldItemList;
use Drupal\Core\TypedData\ComputedItemListTrait;

/**
 * A computed entity reference field item list.
 */
class FlaggedEntityFieldItemList extends EntityReferenceFieldItemList {
  use ComputedItemListTrait;

  /**
   * Returns the label as the field item.
   */
  protected function computeValue() {
    $this->list[0] = $this
      ->createItem(0, $this
      ->getEntity()->value);
  }

}

Classes

Namesort descending Description
FlaggedEntityFieldItemList A computed entity reference field item list.