You are here

function variable_build_list_info in Variable 7.2

Same name and namespace in other branches
  1. 7 variable.inc \variable_build_list_info()

Build variable information

1 call to variable_build_list_info()
variable_build_info in ./variable.inc
Build generic variable information

File

./variable.inc, line 26
Variable API module. Extended API.

Code

function variable_build_list_info($options) {
  $variables = array();
  foreach (module_implements('variable_info') as $module) {
    $result = call_user_func($module . '_variable_info', $options);
    if (isset($result) && is_array($result)) {
      foreach ($result as $name => $variable) {

        // Support name => title declarations
        $variable = is_array($variable) ? $variable : array(
          'title' => $variable,
        );
        $variable += array(
          'name' => $name,
          'module' => $module,
        );

        // Check variable name for multiple values
        $multiple = NULL;
        if (preg_match('/\\[(\\w+)\\]/', $name, $matches)) {
          $multiple = $matches[1];
          $variable += array(
            'type' => 'multiple',
          );
        }
        $variable += array(
          'group' => 'default',
          'type' => 'default',
        );
        $variables[$name] = $variable + variable_get_type($variable['type']);

        // Add this at the end so it doesn't override type properties
        if (!empty($multiple)) {
          $variables[$name] += array(
            'multiple' => $multiple,
          );
        }
      }
    }
  }

  // Last chance for modules to alter variable info.
  drupal_alter('variable_info', $variables, $options);
  return $variables;
}