function 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.

Return value

array Array of contexts, keyed by context ID.

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 1570

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;
}