You are here

protected static function RulesData::typeCalcAncestors in Rules 7.2

1 call to RulesData::typeCalcAncestors()
RulesData::typesMatch in includes/rules.state.inc
Returns whether the type match. They match if type1 is compatible to type2.

File

includes/rules.state.inc, line 424
Contains the state and data related stuff.

Class

RulesData
A class holding static methods related to data.

Code

protected static function typeCalcAncestors(&$cache, $type) {
  if (!isset($cache['data_info'][$type]['ancestors'])) {
    $cache['data_info'][$type]['ancestors'] = array();
    if (isset($cache['data_info'][$type]['parent']) && ($parent = $cache['data_info'][$type]['parent'])) {
      $cache['data_info'][$type]['ancestors'][$parent] = TRUE;
      self::typeCalcAncestors($cache, $parent);

      // Add all parent ancestors to our own ancestors.
      $cache['data_info'][$type]['ancestors'] += $cache['data_info'][$parent]['ancestors'];
    }

    // For special lists like list<node> add in "list" as valid parent.
    if (entity_property_list_extract_type($type)) {
      $cache['data_info'][$type]['ancestors']['list'] = TRUE;
    }
  }
}