function DataListItemRemove::doExecute

Removes an item from a list.

Parameters

array $list: An array to remove an item from.

mixed $item: An item to remove from the array.

File

src/Plugin/RulesAction/DataListItemRemove.php, line 39

Class

DataListItemRemove
Provides a 'Remove item from list' action.

Namespace

Drupal\rules\Plugin\RulesAction

Code

protected function doExecute(array $list, $item) {
    foreach (array_keys($list, $item) as $key) {
        unset($list[$key]);
    }
    $this->setContextValue('list', $list);
}