You are here

function variable_format_properties in Variable 7.2

Format array variable with known keys, handling nested arrays

1 string reference to 'variable_format_properties'
variable_variable_type_info in ./variable.variable.inc
Implements hook_variable_type_info().

File

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

Code

function variable_format_properties($variable = NULL, $options = array()) {
  if (empty($variable['value'])) {
    return variable_format_empty($variable);
  }
  else {
    $rows = array();
    foreach ($variable['value'] as $name => $item) {
      $title = check_plain((string) $name);
      if (is_array($item) || is_object($item)) {
        $value = variable_format_array(array(
          'value' => (array) $item,
        ), $options);
      }
      else {
        $value = check_plain((string) $item);
      }
      $rows[] = array(
        '<em>' . $title . '</em>',
        $value,
      );
    }
    return theme('table', array(
      'rows' => $rows,
    ));
  }
}