function drush_output_get_selected_field

8.0.x output.inc drush_output_get_selected_field($input, $field_name, $default_value = '')
6.x output.inc drush_output_get_selected_field($input, $field_name, $default_value = '')
7.x output.inc drush_output_get_selected_field($input, $field_name, $default_value = '')
master output.inc drush_output_get_selected_field($input, $field_name, $default_value = '')

Given a table array (an associative array of associative arrays), return an array of all of the values with the specified field name.

Related topics

1 call to drush_output_get_selected_field()
drush_outputformat_list::format in commands/core/outputformat/list.inc

File

includes/output.inc, line 478

Code

function drush_output_get_selected_field($input, $field_name, $default_value = '') {
  $result = array();
  foreach ($input as $key => $data) {
    if (is_array($data) && isset($data[$field_name])) {
      $result[] = $data[$field_name];
    }
    else {
      $result[] = $default_value;
    }
  }
  return $result;
}