private function MenuLinkContentVisibilityCache::buildConditions in Custom Menu Links Visibility 8
1 call to MenuLinkContentVisibilityCache::buildConditions()
File
- src/
MenuLinkContentVisibilityCache.php, line 78
Class
Namespace
Drupal\menu_link_content_visibilityCode
private function buildConditions() {
$conditions = [];
if ($visibility = unserialize($this->menu_link_content
->get('visibility')->value)) {
foreach ($visibility as $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) {
}
}
$conditions[$condition_id] = $condition;
}
}
return $conditions;
}