You are here

function _configuration_array_filter in Configuration Management 6

Helper function to filter values of the list of matches

1 call to _configuration_array_filter()
configuration_fetch in ./configuration.module
Find parts of an array based on a semi-compatible xpath syntax.

File

./configuration.module, line 1755
Provide a unified method for defining site configurations abstracted from their data format. Various data formats should be supported via a plugin architecture such as XML, YAML, JSON, PHP

Code

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