function ItemList::appendItem

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::appendItem()
  2. 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::appendItem()
  3. 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::appendItem()

Overrides ListInterface::appendItem

6 calls to ItemList::appendItem()
CommentFieldItemList::get in core/modules/comment/src/CommentFieldItemList.php
Returns the item at the specified position in this list.
FieldItemList::applyDefaultValue in core/lib/Drupal/Core/Field/FieldItemList.php
Applies the default value.
FieldItemList::__set in core/lib/Drupal/Core/Field/FieldItemList.php
Magic method: Sets a property value of the first field item.
ItemList::offsetSet in core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php
ItemList::set in core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php
Sets the value of the item at a given position in the list.

... See full list

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php, line 210

Class

ItemList
A generic list class.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function appendItem($value = NULL) {
    $offset = count($this->list);
    $item = $this->createItem($offset, $value);
    $this->list[$offset] = $item;
    return $item;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.