You are here

public function EventHandler::isMatching in Services Client 7.2

Determine wheather entity is matching event conditions.

Return value

boolean TRUE if etnity matches all conditions.

File

include/event.inc, line 341

Class

EventHandler
Event handler plugin.

Code

public function isMatching() {

  // If no entity is provided return FALSE
  $entity = $this
    ->getEntity();
  if (empty($entity)) {
    return FALSE;
  }

  // Go through each plugin and check if entity matches conditions.
  foreach ($this->config['condition'] as $uuid => $plugin) {
    try {
      $handler = $this
        ->getPluginInstance($plugin['type'], $plugin['config'], $uuid);
      if (!$handler
        ->match($this
        ->getEntity())) {
        return FALSE;
      }
    } catch (Exception $e) {
      watchdog_exception('services_client', $e);
    }
  }

  // All conditions were matched.
  return TRUE;
}