protected function ScriptAccessControlHandler::getPreparedConditions in Script Manager 8
Get the prepared conditions from the block.
Parameters
\Drupal\script_manager\Entity\ScriptInterface $entity: The entity to get conditions for.
Return value
array An array of conditions.
Throws
\Drupal\Component\Plugin\Exception\ContextException
1 call to ScriptAccessControlHandler::getPreparedConditions()
- ScriptAccessControlHandler::checkAccess in src/
Entity/ ScriptAccessControlHandler.php - Performs access checks.
File
- src/
Entity/ ScriptAccessControlHandler.php, line 102
Class
- ScriptAccessControlHandler
- Access control handler for script entities.
Namespace
Drupal\script_manager\EntityCode
protected function getPreparedConditions(ScriptInterface $entity) {
$conditions = [];
foreach ($entity
->getVisibilityConditions() as $condition_id => $condition) {
if ($condition instanceof ContextAwarePluginInterface) {
$contexts = $this->contextRepository
->getRuntimeContexts(array_values($condition
->getContextMapping()));
$this->contextHandler
->applyContextMapping($condition, $contexts);
$conditions[$condition_id] = $condition;
}
}
return $conditions;
}