function drush_key_value_to_array_table

8.0.x output.inc drush_key_value_to_array_table($keyvalue_table, $metadata = array())
6.x output.inc drush_key_value_to_array_table($keyvalue_table, $metadata = array())
7.x output.inc drush_key_value_to_array_table($keyvalue_table, $metadata = array())
3.x drush.inc drush_key_value_to_array_table($keyvalue_table)
4.x drush.inc drush_key_value_to_array_table($keyvalue_table)
5.x output.inc drush_key_value_to_array_table($keyvalue_table)
master output.inc drush_key_value_to_array_table($keyvalue_table, $metadata = array())

Convert an associative array of key : value pairs into a table suitable for processing by drush_print_table.

Parameters

$keyvalue_table: An associative array of key : value pairs.

Return value

An array of arrays, where the keys from the input array are stored in the first column, and the values are stored in the third. A second colum is created specifically to hold the ':' separator.

Related topics

6 calls to drush_key_value_to_array_table()
drush_core_shell_alias in commands/core/shellalias.drush.inc
Print out the specified shell aliases.
drush_core_status in commands/core/core.drush.inc
Command callback. Provides a birds-eye view of the current Drupal installation.
drush_core_watchdog_show_one in commands/core/watchdog.drush.inc
Print a watchdog message.
drush_pm_info in commands/pm/info.pm.inc
Command callback. Show detailed info for one or more extensions.
drush_xkcd_display in examples/xkcd.drush.inc
Retrieve and display a table of metadata for an XKCD cartoon, then retrieve and display the cartoon using a specified image viewer.

... See full list

File

includes/output.inc, line 249

Code

function drush_key_value_to_array_table($keyvalue_table) {
  $table = array();
  foreach ($keyvalue_table as $key => $value) {
    if (isset($value)) {
      $table[] = array($key, ' :', $value);
    }
    else {
      $table[] = array($key . ':', '', '');
    }
  }
  return $table;
}