You are here

class panels_required_context in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/plugins.inc \panels_required_context
  2. 6.3 includes/plugins.inc \panels_required_context

This is used to explain to Panels what context is required.

Hierarchy

Expanded class hierarchy of panels_required_context

2 string references to 'panels_required_context'
panels_optional_context::panels_optional_context in includes/plugins.inc
_panels_page_construct_argument_contexts in panels_page/panels_page.module
Extracts context data from provided URLs; helper function for _panels_page_master_loader().

File

includes/plugins.inc, line 74
plugins.inc

View source
class panels_required_context {
  var $keywords = '';
  function panels_required_context() {
    $args = func_get_args();
    $this->title = array_shift($args);
    if (count($args) == 1) {
      $args = array_shift($args);
    }
    $this->keywords = $args;
  }
  function filter($contexts) {
    $result = array();

    // See which of these contexts are valid
    foreach ((array) $contexts as $cid => $context) {
      if ($context
        ->is_type($this->keywords)) {
        $result[$cid] = $context;
      }
    }
    return $result;
  }
  function select($contexts, $context) {
    if (empty($context) || empty($contexts[$context])) {
      return FALSE;
    }
    return $contexts[$context];
  }

}

Members