You are here

function ctools_context_get_context_from_contexts in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/context.inc \ctools_context_get_context_from_contexts()

Retrieve a list of base contexts based upon a simple 'contexts' definition.

For required contexts this will always retrieve placeholders.

Parameters

$contexts: The list of contexts defined in the UI.

$type: Either 'context' or 'requiredcontext', which indicates whether the contexts are loaded from internal data or copied from an external source.

$placeholders: If true, placeholders are acceptable.

1 call to ctools_context_get_context_from_contexts()
ctools_context_load_contexts in includes/context.inc
Load a full array of contexts for an object.

File

includes/context.inc, line 1064
Contains code related to the ctools system of 'context'.

Code

function ctools_context_get_context_from_contexts($contexts, $type = 'context', $placeholders = FALSE) {
  $return = array();
  foreach ($contexts as $context) {
    $ctext = ctools_context_get_context_from_context($context, $type);
    if ($ctext) {
      if ($placeholders) {
        $ctext->placeholder = TRUE;
      }
      $return[ctools_context_id($context, $type)] = $ctext;
    }
  }
  return $return;
}