You are here

function _patterns_array_filter in Patterns 6.2

Same name and namespace in other branches
  1. 6 patterns.module \_patterns_array_filter()
  2. 7.2 includes/unused.inc \_patterns_array_filter()
  3. 7 includes/unused.inc \_patterns_array_filter()

Helper function to filter values of the list of matches

1 call to _patterns_array_filter()
patterns_array_fetch in ./patterns.module
Find parts of an array based on a semi-compatible xpath syntax.

File

./patterns.module, line 2800
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function _patterns_array_filter(&$matches, $operator, $value = null) {
  for ($i = count($matches) - 1; $i >= 0; $i--) {
    $match =& $matches[$i];
    switch ($operator) {
      case '=':
        if ($match['item'] != $value) {
          array_splice($matches, $i, 1);
        }
        break;
    }
  }
}