You are here

function variable_format_array in Variable 7.2

Same name and namespace in other branches
  1. 6 variable.variable.inc \variable_format_array()
  2. 7 variable.variable.inc \variable_format_array()

Format array variable, handling nested arrays

2 calls to variable_format_array()
variable_format_properties in ./variable.variable.inc
Format array variable with known keys, handling nested arrays
variable_form_element_array in ./variable.form.inc
Build array form element
1 string reference to 'variable_format_array'
variable_variable_type_info in ./variable.variable.inc
Implements hook_variable_type_info().

File

./variable.variable.inc, line 219
Variable module hook implementations

Code

function variable_format_array($variable = NULL, $options = array()) {
  if (empty($variable['value'])) {
    return variable_format_empty($variable);
  }
  else {
    $list = array();
    foreach ($variable['value'] as $index => $item) {
      if (is_array($item) || is_object($item)) {
        $list[$index] = variable_format_array(array(
          'value' => (array) $item,
        ), $options);
      }
      else {
        $list[$index] = check_plain((string) $item);
      }
    }
    return theme('item_list', array(
      'items' => $list,
    ));
  }
}