/** * Shows diff of specified configuration file. * * @param string $source_name * The name of the configuration file. * @param string $target_name * (optional) The name of the target configuration file if different from * the $source_name. * @param string $collection * (optional) The configuration collection name. Defaults to the default * collection. * * @return string * Table showing a two-way diff between the active and staged configuration. */ public function diff($source_name, $target_name = NULL, $collection = NULL) { if (!isset($collection)) { $collection = StorageInterface::DEFAULT_COLLECTION; } $diff = $this->configManager->diff($this->targetStorage, $this->sourceStorage, $source_name, $target_name, $collection); $this->diffFormatter->show_header = FALSE; $build = array(); $build['#title'] = t('View changes of @config_file', array('@config_file' => $source_name)); // Add the CSS for the inline diff. $build['#attached']['library'][] = 'system/diff'; $build['diff'] = array('#type' => 'table', '#header' => array(array('data' => t('Active'), 'colspan' => '2'), array('data' => t('Staged'), 'colspan' => '2')), '#rows' => $this->diffFormatter->format($diff)); $build['back'] = array('#type' => 'link', '#attributes' => array('class' => array('dialog-cancel')), '#title' => "Back to 'Synchronize configuration' page.", '#url' => Url::fromRoute('config.sync')); return $build; }
/** * Shows diff of specified configuration file. * * @param string $source_name * The name of the configuration file. * @param string $target_name * (optional) The name of the target configuration file if different from * the $source_name. * @param string $collection * (optional) The configuration collection name. Defaults to the default * collection. * * @return string * Table showing a two-way diff between the active and staged configuration. */ public function diff($source_name, $target_name = NULL, $collection = NULL) { if (!isset($collection)) { $collection = StorageInterface::DEFAULT_COLLECTION; } $diff = $this->configManager->diff($this->targetStorage, $this->sourceStorage, $source_name, $target_name, $collection); $this->diffFormatter->show_header = FALSE; $build = array(); $build['#title'] = t('View changes of @config_file', array('@config_file' => $source_name)); // Add the CSS for the inline diff. $build['#attached']['css'][] = drupal_get_path('module', 'system') . '/css/system.diff.css'; $build['diff'] = array('#type' => 'table', '#header' => array(array('data' => t('Old'), 'colspan' => '2'), array('data' => t('New'), 'colspan' => '2')), '#rows' => $this->diffFormatter->format($diff)); $build['back'] = array('#type' => 'link', '#attributes' => array('class' => array('dialog-cancel')), '#title' => "Back to 'Synchronize configuration' page.", '#href' => 'admin/config/development/configuration'); return $build; }