Shows diff of specificed configuration file.
string $config_file: The name of the configuration file.
string Table showing a two-way diff between the active and staged configuration.
public function diff($config_file) {
// Add the CSS for the inline diff.
$output['#attached']['css'][] = drupal_get_path('module', 'system') . '/css/system.diff.css';
$diff = config_diff($this->targetStorage, $this->sourceStorage, $config_file);
$formatter = new \DrupalDiffFormatter();
$formatter->show_header = FALSE;
$variables = array(
'header' => array(
array(
'data' => t('Old'),
'colspan' => '2',
),
array(
'data' => t('New'),
'colspan' => '2',
),
),
'rows' => $formatter
->format($diff),
);
$output['diff'] = array(
'#markup' => theme('table', $variables),
);
$output['back'] = array(
'#type' => 'link',
'#attributes' => array(
'class' => array(
'dialog-cancel',
),
),
'#title' => "Back to 'Synchronize configuration' page.",
'#href' => 'admin/config/development/sync',
);
// @todo Remove use of drupal_set_title() when
// http://drupal.org/node/1871596 is in.
drupal_set_title(t('View changes of @config_file', array(
'@config_file' => $config_file,
)), PASS_THROUGH);
return $output;
}