function drush_outputformat_variables::format

8.0.x variables.inc drush_outputformat_variables::format($data, $metadata)
6.x variables.inc drush_outputformat_variables::format($data, $metadata)
7.x variables.inc drush_outputformat_variables::format($data, $metadata)
master variables.inc drush_outputformat_variables::format($data, $metadata)

Overrides drush_outputformat::format

File

commands/core/outputformat/variables.inc, line 38

Class

drush_outputformat_variables
Output formatter 'variables'

Code

function format($data, $metadata) {
  $output = '';
  if (is_array($data)) {
    foreach ($data as $variable_name => $section) {
      foreach ($section as $label => $value) {
        $metameta = array(
          'variable-name' => $variable_name,
          'label' => $label,
        );
        $formatted_item = $this->sub_engine->process($value, $metameta);
        if ($formatted_item === FALSE) {
          return FALSE;
        }
        $output .= $formatted_item;
        $output .= "\n";
      }
    }
  }
  return $output;
}