function ListInterface::filter

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/TypedData/ListInterface.php \Drupal\Core\TypedData\ListInterface::filter()
  2. 10 core/lib/Drupal/Core/TypedData/ListInterface.php \Drupal\Core\TypedData\ListInterface::filter()
  3. 11.x core/lib/Drupal/Core/TypedData/ListInterface.php \Drupal\Core\TypedData\ListInterface::filter()

Filters the items in the list using a custom callback.

Parameters

callable $callback: The callback to use for filtering. Like with array_filter(), the callback is called for each item in the list. Only items for which the callback returns TRUE are preserved.

Return value

$this

1 method overrides ListInterface::filter()
ItemList::filter in core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php
Filters the items in the list using a custom callback.

File

core/lib/Drupal/Core/TypedData/ListInterface.php, line 125

Class

ListInterface
Interface for a list of typed data.

Namespace

Drupal\Core\TypedData

Code

public function filter($callback);

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