You are here

function field_token_value_get_wrappers in Field Token Value 7

Helper function to aggregate all wrapper options for the field formatter.

Return value

array An array containing all wrapper options.

2 calls to field_token_value_get_wrappers()
field_token_value_get_wrapper_by_key in ./field_token_value.module
Helper function to retrieve a single wrapper item.
field_token_value_get_wrapper_options in ./field_token_value.module
Helper function to return a keyed array of wrappers for the field formatter settings form.

File

./field_token_value.module, line 219
Provides a field type allowing the value to be set using tokens.

Code

function field_token_value_get_wrappers() {
  $wrappers =& drupal_static(__FUNCTION__);
  if (!isset($wrappers)) {
    $wrappers = array();
    foreach (module_implements('field_token_value_wrapper_info') as $module) {
      $wrapper = module_invoke($module, 'field_token_value_wrapper_info');
      if (!is_array($wrapper)) {
        watchdog('field_token_value', 'A wrapper implemented by the module %module is not valid.', array(
          '%module' => $module,
        ));
        continue;
      }
      foreach ($wrapper as $key => $info) {
        if (empty($info['tag']) || empty($info['title'])) {
          watchdog('field_token_value', 'The wrapper with the key %key implemented by the module %module is not valid.', array(
            '%key' => $key,
            '%module' => $module,
          ));
          continue;
        }
        $wrappers[$key] = $info;
      }
    }

    // Allow modules to alter the wrapper info.
    drupal_alter('field_token_value_wrapper_info', $wrappers);
  }
  return $wrappers;
}