You are here

function configuration_ui_config_diff in Configuration Management 7.2

Menu Callback Form.

1 string reference to 'configuration_ui_config_diff'
configuration_ui_menu in ui/configuration_ui.module
Implements hook_menu().

File

ui/configuration_ui.admin.inc, line 349
User interface functions for Configuration Management.

Code

function configuration_ui_config_diff($config_id) {
  $activestore = ConfigurationManagement::createConfigurationInstance($config_id);
  $datastore = ConfigurationManagement::createConfigurationInstance($config_id);
  drupal_add_css(drupal_get_path('module', 'configuration_ui') . '/theme/configuration.css');
  $output = '';
  module_load_include('inc', 'diff', 'diff.engine');
  $formatter = new DrupalDiffFormatter();
  $formatter->leading_context_lines = 2;
  $formatter->trailing_context_lines = 2;
  $rows[] = array();
  $diff = new Diff(explode("\n", $datastore
    ->loadFromStorage()
    ->raw()), explode("\n", $activestore
    ->loadFromActiveStore()
    ->raw()));
  $rows = array_merge($rows, $formatter
    ->format($diff));
  $header = array(
    array(
      'data' => t('Datastore'),
      'colspan' => 2,
    ),
    array(
      'data' => t('Activestore'),
      'colspan' => 2,
    ),
  );
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'diff',
        'configuration-diff',
      ),
    ),
  ));
  $output = array(
    'page' => array(
      '#markup' => "<div class='configuration-comparison'>{$output}</div>",
    ),
  );
  return $output;
}