function ctools_context_get_form

Return the first context with a form id from a list of contexts.

This function is used to figure out which contexts represents 'the form' from a list of contexts. Only one contexts can actually be 'the form' for a given page, since the


{<form>}

tag can not be embedded within itself.

File

includes/context.inc, line 1694

Code

function ctools_context_get_form($contexts) {
    if (!empty($contexts)) {
        foreach ($contexts as $id => $context) {
            // If a form shows its id as being a 'required context' that means the
            // the context is external to this display and does not count.
            if (!empty($context->form_id) && substr($id, 0, 15) != 'requiredcontext') {
                return $context;
            }
        }
    }
}