You are here

public function EntitySubqueueItemsFieldItemList::appendItem in Entityqueue 8

Appends a new item to the list.

Parameters

mixed $value: The value of the new item.

Return value

\Drupal\Core\TypedData\TypedDataInterface The item that was appended.

Overrides ItemList::appendItem

File

src/EntitySubqueueItemsFieldItemList.php, line 15

Class

EntitySubqueueItemsFieldItemList
Defines an item list class for a subqueue's items.

Namespace

Drupal\entityqueue

Code

public function appendItem($value = NULL) {

  // If the queue is reversed, new items should be be added to the top of the
  // queue.
  if ($this
    ->getEntity()
    ->getQueue()
    ->isReversed()) {
    $item = $this
      ->createItem(0, $value);
    array_unshift($this->list, $item);
    return $item;
  }
  return parent::appendItem($value);
}