You are here

function mefibs_remove_value_from_array in MEFIBS - More exposed forms in blocks 7

Remove an item from an array based on the value.

Parameters

array $array:

mixed $values: Either a single element or an array of elements that will be removed

1 call to mefibs_remove_value_from_array()
mefibs_exposed_block_form in ./mefibs.module
Form builder for the additional exposed form.

File

./mefibs.module, line 1236
Primarily Drupal hooks and global API functions to manipulate views and to provide an additional block with an exposed filter form.

Code

function mefibs_remove_value_from_array(&$array, $values) {
  if (!count($array)) {
    return;
  }

  // Make sure we have an array.
  if (!is_array($values)) {
    $values = array(
      $values,
    );
  }
  foreach ($array as $key => $value) {
    if (in_array($value, $values)) {
      unset($array[$key]);
    }
  }
}