You are here

function ctools_context::is_type in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/context.inc \ctools_context::is_type()

File

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

Class

ctools_context
The context object is largely a wrapper around some other object, with an interface to finding out what is contained and getting to both the object and information about the object.

Code

function is_type($type) {
  if ($type == 'any' || $this->type == 'any') {
    return TRUE;
  }
  $a = is_array($type) ? $type : array(
    $type,
  );
  $b = is_array($this->type) ? $this->type : array(
    $this->type,
  );
  return (bool) array_intersect($a, $b);
}