function _drush_format_config_changes_table

8.0.x config.drush.inc _drush_format_config_changes_table(array $config_changes, $use_color = FALSE)
7.x config.drush.inc _drush_format_config_changes_table(array $config_changes, $use_color = FALSE)
master config.drush.inc _drush_format_config_changes_table(array $config_changes, $use_color = FALSE)

Print a table of config changes.

Parameters

array $config_changes: An array of changes keyed by collection.

2 calls to _drush_format_config_changes_table()
_drush_config_export in commands/core/config.drush.inc
_drush_print_config_changes_table in commands/core/config.drush.inc
Print a table of config changes.

File

commands/core/config.drush.inc, line 883
Provides Configuration Management commands.

Code

function _drush_format_config_changes_table(array $config_changes, $use_color = FALSE) {
  if (!$use_color) {
    $red = "%s";
    $yellow = "%s";
    $green = "%s";
  }
  else {
    $red = "\033[31;40m\033[1m%s\033[0m";
    $yellow = "\033[1;33;40m\033[1m%s\033[0m";
    $green = "\033[1;32;40m\033[1m%s\033[0m";
  }

  $rows = array();
  $rows[] = array('Collection', 'Config', 'Operation');
  foreach ($config_changes as $collection => $changes) {
    foreach ($changes as $change => $configs) {
      switch ($change) {
        case 'delete':
          $colour = $red;
          break;
        case 'update':
          $colour = $yellow;
          break;
        case 'create':
          $colour = $green;
          break;
        default:
          $colour = "%s";
          break;
      }
      foreach ($configs as $config) {
        $rows[] = array(
          $collection,
          $config,
          sprintf($colour, $change),
        );
      }
    }
  }
  $tbl = _drush_format_table($rows);
  return $tbl;
}