protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) {
    foreach ($conditions as $condition) {
      if ($condition instanceof ContextAwarePluginInterface) {
        try {
          if (empty($provided)) {
            $contexts = $this->contextRepository->getRuntimeContexts(array_values($condition->getContextMapping()));
          }
          else {
            $contexts = $provided;
          }
          $this->contextHandler->applyContextMapping($condition, $contexts);
        }
        catch (ContextException $e) {
          return FALSE;
        }
      }
    }

    return TRUE;
  }
protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) {
    foreach ($conditions as $condition) {
      if ($condition instanceof ContextAwarePluginInterface) {
        try {
          if (empty($provided)) {
            $contexts = $this->contextRepository->getRuntimeContexts(array_values($condition->getContextMapping()));
          }
          else {
            $contexts = $provided;
          }
          $this->contextHandler->applyContextMapping($condition, $contexts);
        }
        catch (ContextException $e) {
          return FALSE;
        }
      }
    }

    return TRUE;
  }
protected function applyContexts ( ConditionPluginCollection & $ conditions , array $ provided = [ ] ) { foreach ( $ conditions as $ condition ) { if ( $ condition instanceof ContextAwarePluginInterface ) { try { if ( empty ( $ provided ) ) { $ contexts = $ this -> contextRepository -> getRuntimeContexts ( array_values ( $ condition -> getContextMapping ( ) ) ) ; } else { $ contexts = $ provided ; } $ this -> contextHandler -> applyContextMapping ( $ condition , $ contexts ) ; } catch ( ContextException $ e ) { return FALSE ; } } } return TRUE ; }
Apply context to all the context aware conditions in the collection.

@param \Drupal\Core\Condition\ConditionPluginCollection $conditions
A collection of conditions to apply context to.
@param \Drupal\Core\Plugin\Context\Context[] $provided
Additional provided (core) contexts to apply to Conditions.

@return bool
TRUE if conditions pass
Apply context to all the context aware conditions in the collection .