private function MenuLinkContentVisibilityChecker::evaluateCondition in Custom Menu Links Visibility 8
1 call to MenuLinkContentVisibilityChecker::evaluateCondition()
File
- src/
MenuLinkContentVisibilityChecker.php, line 59
Class
Namespace
Drupal\menu_link_content_visibilityCode
private function evaluateCondition($condition_id, $condition_configuration) {
/** @var ConditionInterface $condition */
$condition = $this->condition_manager
->createInstance($condition_id, $condition_configuration);
if ($condition instanceof ContextAwarePluginInterface) {
$contexts = $this->context_repository
->getRuntimeContexts(array_values($condition
->getContextMapping()));
try {
$this->context_handler
->applyContextMapping($condition, $contexts);
} catch (ContextException $e) {
return TRUE;
}
}
return $condition
->evaluate();
}