You are here

public function RulesListConditionsConditionalLoop::listItemInfo in Rules List Conditions 7

Return information about the list being iterated over.

Return value

array An associate array containing 'type': The type of the list's elements (or unknown if not set). 'label': The human readable label, if set.

2 calls to RulesListConditionsConditionalLoop::listItemInfo()
RulesListConditionsConditionalLoop::setListVar in includes/rules_list_conditions.core.inc
Internal helper for child loops to set current item in loop body.
RulesListConditionsConditionalLoop::stateVariables in includes/rules_list_conditions.core.inc
Overridden to exclude variable assertions of negated conditions.

File

includes/rules_list_conditions.core.inc, line 99
Contains the base class for condition loops.

Class

RulesListConditionsConditionalLoop
Base class for condition loops.

Code

public function listItemInfo() {
  if (!isset($this->listItemInfo)) {
    if ($info = $this
      ->getArgumentInfo('list')) {

      // Pass through the variable info keys like property info.
      $iks = array_flip(array(
        'type',
        'property info',
        'bundle',
      ));
      $this->listItemInfo = array_intersect_key($info, $iks);
      $this->listItemInfo['type'] = isset($info['type']) ? entity_property_list_extract_type($info['type']) : 'unknown';
    }
    else {
      $this->listItemInfo = array(
        'type' => 'unknown',
      );
    }
    $this->listItemInfo['label'] = $this->settings['item:label'];
  }
  return $this->listItemInfo;
}