You are here

function variable_format_array in Variable 6

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

Format array variable, handling nested arrays

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 190
Variable module hook implementations

Code

function variable_format_array($variable = NULL, $options = array()) {
  if (empty($variable['value'])) {
    return variable_format_empty($variable);
  }
  else {
    $elements = array();
    foreach ($variable['value'] as $item) {
      $elements[] = is_array($item) ? '(' . variable_format_array(array(
        'value' => $item,
      ), $options) . ')' : check_plain($item);
    }
    return implode(', ', $elements);
  }
}