You are here

function _voting_rules_token_data_info_recursion in Voting Rules 7

Recursively build token info.

1 call to _voting_rules_token_data_info_recursion()
voting_rules_token_info in ./voting_rules.tokens.inc
Implements hook_token_info().

File

./voting_rules.tokens.inc, line 59
Builds placeholder replacement tokens.

Code

function _voting_rules_token_data_info_recursion(&$info, $type, $data, $prefix = NULL) {
  if (isset($data['property info'])) {
    foreach ($data['property info'] as $property_name => $property_info) {
      $formatted_name = str_replace('_', '-', $property_name);
      $formatted_name = isset($prefix) ? $prefix . '-' . $formatted_name : $formatted_name;
      if (!isset($property_info['property info'])) {
        $info['tokens'][$type][$formatted_name] = array(
          'name' => $property_info['label'],
          'description' => isset($property_info['description']) ? $property_info['description'] : t('No description'),
        );
      }
      _voting_rules_token_data_info_recursion($info, $type, $property_info, $formatted_name);
    }
  }
}