1 layout_access.inc | LayoutAccess::setContexts(array $all_contexts) |
Sets the contexts for this item from the full list of layout contexts.
This method converts all available contexts provided by a layout to consistent keys expected by the access rule. For example a layout might have contexts keyed as "node" and "node2", but an access rule may only use a single context keyed as "node". It's possible for either layout context to be stored as the single context needed for the access rule.
Parameters
array $all_contexts: An array of context instances used by the entire layout that contains this access rule.
Return value
boolean: TRUE if all required contexts have been provided, FALSE if the layout's contexts did not provide every required context needed by this access rule.
File
- core/
modules/ layout/ plugins/ access/ layout_access.inc, line 111 - Class for loading, modifying, and saving a layout access rule (condition).
Class
- LayoutAccess
- @file Class for loading, modifying, and saving a layout access rule (condition).
Code
function setContexts(array $all_contexts) {
$required_contexts = $this->getRequiredContexts();
if (empty($required_contexts)) {
return TRUE;
}
return layout_set_handler_contexts($this->contexts, $all_contexts, $required_contexts, $this->settings['contexts']);
}