1 layout.class.inc private Layout::getContextsByType($contexts, $include_types = LayoutContext::USAGE_TYPE_ALL)

Return an array of contexts filtered by types specified.

Include a specific list of contexts based on how they are used.

Parameters

array $contexts: The array of contexts to be filtered.

Return value

LayoutContext[]:

File

core/modules/layout/includes/layout.class.inc, line 854
Class for loading, modifying, and executing a layout.

Class

Layout
@file Class for loading, modifying, and executing a layout.

Code

private function getContextsByType($contexts, $include_types = LayoutContext::USAGE_TYPE_ALL) {
  // Return all contexts if requested.
  if ($include_types === LayoutContext::USAGE_TYPE_ALL) {
    return $contexts;
  }

  // Otherwise filter down the list of contexts to only those requested.
  $return_contexts = array();
  foreach ($contexts as $key => $context) {
    if ($context->usageType & $include_types) {
      $return_contexts[$key] = $context;
    }
  }

  return $return_contexts;
}