You are here

public function OrCondition::isMatched in Access Filter 8

Checks the current access is matched to the condition.

Parameters

\Symfony\Component\HttpFoundation\Request $request: A request instance.

Return value

bool Boolean TRUE if condition is matched or FALSE otherwise.

Overrides ConditionInterface::isMatched

File

src/Plugin/AccessFilter/Condition/OrCondition.php, line 23

Class

OrCondition
Filter condition that chains conditions with 'OR'.

Namespace

Drupal\access_filter\Plugin\AccessFilter\Condition

Code

public function isMatched(Request $request) {
  if (empty($this->configuration['conditions'])) {
    return TRUE;
  }
  foreach ($this->configuration['conditions'] as $condition) {
    $instance = $this
      ->createPluginInstance($condition);
    if ($instance && $instance
      ->isMatched($request)) {
      return TRUE;
    }
  }
  return FALSE;
}