1 layout.class.inc private Layout::getContextsFromRelationships()

Load the contexts based on this Layout's relationship configuration.

File

core/modules/layout/includes/layout.class.inc, line 959
Class for loading, modifying, and executing a layout.

Class

Layout
@file Class for loading, modifying, and executing a layout.

Code

private function getContextsFromRelationships() {
  $contexts = array();
  $contexts_from_relationships_list = array();
  foreach ($this->relationships as $relationship_name => $relationship_data) {
    $key = 'relationship_' . $relationship_name;
    if (!isset($contexts_from_relationships_list[$key])) {
      foreach ($this->contexts as $context) {
        if ($context->plugin == $relationship_data->context) {
          $plugin_array = explode(':', $relationship_data->settings['relationship']);
          if ($plugin_array[1] != 'child') {
            $relationship_data->childDelta = $plugin_array[1];
          }
          $contexts_from_relationships_list[$key] = $this->getContextFromRelationship($relationship_data, $context);
        }
      }
    }
  }
  if ($contexts_from_relationships_list) {
    foreach ($contexts_from_relationships_list as $key => $context_from_relationships) {
      if (is_object($context_from_relationships)) {
        $contexts[$key] = $context_from_relationships;
      }
    }
  }
  return $contexts;
}