You are here

public function ViewInclusion::evaluate in Context 8

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

Return value

bool

Overrides ConditionInterface::evaluate

File

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

Class

ViewInclusion
Provides a 'Views' condition.

Namespace

Drupal\context\Plugin\Condition

Code

public function evaluate() {
  $route = str_replace('.', '-', $this->currentRouteMatch
    ->getRouteName());
  $configuration = $this
    ->getConfiguration();
  if (array_key_exists('view_inclusion', $configuration) && !empty($configuration['view_inclusion'])) {
    return in_array($route, $configuration['view_inclusion']);
  }
  return FALSE;
}