You are here

public function PathCondition::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/PathCondition.php, line 84

Class

PathCondition
Filter condition using drupal path.

Namespace

Drupal\access_filter\Plugin\AccessFilter\Condition

Code

public function isMatched(Request $request) {
  $path = $request
    ->getPathInfo();
  if (empty($this->configuration['regex'])) {
    return $this->pathMatcher
      ->matchPath($path, $this->configuration['path']);
  }
  else {
    return (bool) preg_match($this->configuration['path'], $path);
  }
}