You are here

function panels_context_load_contexts in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/plugins.inc \panels_context_load_contexts()

Get a group of empty contexts for the object; this assumes all the standard context types, and doesn't punish you if they aren't available.

12 calls to panels_context_load_contexts()
panels_ajax_context_item_add in includes/common-context.inc
Ajax entry point to add an context
panels_ajax_context_item_edit in includes/common-context.inc
Ajax entry point to edit an item
panels_common_add_relationship_form in includes/common-context.inc
panels_mini_block in panels_mini/panels_mini.module
Implementation of hook_block().
panels_mini_content in panels_mini/panels_mini.module
Render a mini panel called from a panels display.

... See full list

File

includes/plugins.inc, line 1179
plugins.inc

Code

function panels_context_load_contexts($object, $placeholders = TRUE, $contexts = array()) {
  if ($placeholders) {

    // This will load empty contexts as placeholders for arguments that come
    // from external sources. If this isn't set, it's assumed these context
    // will already have been matched up and loaded.
    if (!empty($object->requiredcontexts) && is_array($object->requiredcontexts)) {
      $contexts += panels_context_get_contexts($object->requiredcontexts, 'requiredcontext');
    }
    if (!empty($object->arguments) && is_array($object->arguments)) {
      $contexts += panels_argument_get_contexts($object->arguments);
    }
  }
  if (!empty($object->contexts) && is_array($object->contexts)) {
    $contexts += panels_context_get_contexts($object->contexts);
  }

  // add contexts from relationships
  if (!empty($object->relationships) && is_array($object->relationships)) {
    panels_relationship_get_contexts($object->relationships, $contexts);
  }
  return $contexts;
}