Browse Source

Be consistent with context module, issue 3177007

pull/931/head
Lucas van Schaik 2 years ago
parent
commit
b89da473f1
  1. 8
      src/IslandoraContextManager.php

8
src/IslandoraContextManager.php

@ -50,7 +50,7 @@ class IslandoraContextManager extends ContextManager {
// Apply context to any context aware conditions. // Apply context to any context aware conditions.
// Abort if the application of contexts has been unsuccessful // Abort if the application of contexts has been unsuccessful
// similarly to BlockAccessControlHandler::checkAccess(). // similarly to BlockAccessControlHandler::checkAccess().
if (count($conditions) > 0 && !$this->applyContexts($conditions, $provided)) { if (!$this->applyContexts($conditions, $provided)) {
return FALSE; return FALSE;
} }
@ -80,6 +80,12 @@ class IslandoraContextManager extends ContextManager {
* TRUE if conditions pass * TRUE if conditions pass
*/ */
protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) { protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) {
// If no contexts to check, the return should be TRUE.
// For example, empty is the same as sitewide condition.
if (count($conditions) === 0) {
return TRUE;
}
$passed = FALSE; $passed = FALSE;
foreach ($conditions as $condition) { foreach ($conditions as $condition) {
if ($condition instanceof ContextAwarePluginInterface) { if ($condition instanceof ContextAwarePluginInterface) {

Loading…
Cancel
Save