You are here

function _ctools_context_filter in Chaos Tool Suite (ctools) 7

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

Helper function for ctools_context_filter().

Used to transform the required context during the merge into the final array.

@internal This function DOES NOT form part of the CTools API.

Parameters

array $contexts: A keyed array of all available contexts.

ctools_context_required|ctools_context_optional $required: A ctools_context_required or ctools_context_optional object, although if given something else will return an empty array.

Return value

array

1 call to _ctools_context_filter()
ctools_context_filter in includes/context.inc
Return a keyed array of context that match the given 'required context' filters.

File

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

Code

function _ctools_context_filter($contexts, $required) {
  $result = array();
  if (is_object($required)) {
    $result = $required
      ->filter($contexts);
  }
  return $result;
}