You are here

public function ViewInclusion::evaluate in Context 8.4

Same name and namespace in other branches
  1. 8 src/Plugin/Condition/ViewInclusion.php \Drupal\context\Plugin\Condition\ViewInclusion::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

src/Plugin/Condition/ViewInclusion.php, line 144

Class

ViewInclusion
Provides a 'Views' condition.

Namespace

Drupal\context\Plugin\Condition

Code

public function evaluate() {
  if (empty($this->configuration['view_inclusion'])) {

    // Return TRUE if empty.
    return TRUE;
  }
  $route = str_replace('.', '-', $this->currentRouteMatch
    ->getRouteName());
  return in_array($route, $this->configuration['view_inclusion'], TRUE);
}