You are here

protected function ServicesClientFieldCondition::equals in Services Client 7.2

Check if configured property equals configured value.

Parameters

stdClass $entity: Drupal entity that is tested.

Return value

boolean TRUE if empty

1 call to ServicesClientFieldCondition::equals()
ServicesClientFieldCondition::match in include/condition.inc
Match entity with condition.

File

include/condition.inc, line 241

Class

ServicesClientFieldCondition

Code

protected function equals($entity) {
  if ($this
    ->isEmpty($entity)) {
    return FALSE;
  }
  else {
    $items = isset($entity->{$this->config['field']}[$this->config['language']]) ? $entity->{$this->config['field']}[$this->config['language']] : NULL;
    foreach ((array) $items as $item) {
      if (isset($item[$this->config['property']]) && $item[$this->config['property']] == $this->config['value']) {
        return TRUE;
      }
    }
  }
  return FALSE;
}