function ItemList::removeItem
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::removeItem()
- 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::removeItem()
- 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::removeItem()
Overrides ListInterface::removeItem
1 call to ItemList::removeItem()
- ItemList::offsetUnset in core/
lib/ Drupal/ Core/ TypedData/ Plugin/ DataType/ ItemList.php
File
-
core/
lib/ Drupal/ Core/ TypedData/ Plugin/ DataType/ ItemList.php, line 133
Class
- ItemList
- A generic list class.
Namespace
Drupal\Core\TypedData\Plugin\DataTypeCode
public function removeItem($index) {
if (isset($this->list) && array_key_exists($index, $this->list)) {
// Remove the item, and reassign deltas.
unset($this->list[$index]);
$this->rekey($index);
}
else {
throw new \InvalidArgumentException('Unable to remove item at non-existing index.');
}
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.