Skip to content
Snippets Groups Projects
Select Git revision
  • 6098437ef5529d190c2997a1b6896af708377001
  • 11.x default protected
  • 11.2.x protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

config.module

Blame
  • Alex Pott's avatar
    Issue #2714829 by Mile23: Fix 'Generic.Functions.FunctionCallArgumentSpacing' coding standard
    Alex Pott authored
    4376b33c
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    config.module 4.67 KiB
    <?php
    
    /**
     * @file
     * Allows site administrators to modify configuration.
     */
    
    use Drupal\Core\Routing\RouteMatchInterface;
    
    /**
     * Implements hook_help().
     */
    function config_help($route_name, RouteMatchInterface $route_match) {
      switch ($route_name) {
        case 'help.page.config':
          $output = '';
          $output .= '<h3>' . t('About') . '</h3>';
          $output .= '<p>' . t('The Configuration Manager module provides a user interface for importing and exporting configuration changes between installations of your website in different environments. Configuration is stored in YAML format. For more information, see the <a href=":url">online documentation for the Configuration Manager module</a>.', array(':url' => 'https://www.drupal.org/documentation/administer/config')) . '</p>';
          $output .= '<h3>' . t('Uses') . '</h3>';
          $output .= '<dl>';
          $output .= '<dt>' . t('Exporting the full configuration') . '</dt>';
          $output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.', array(':url' => \Drupal::url('config.export_full'))) . '</dd>';
          $output .= '<dt>' . t('Importing a full configuration') . '</dt>';
          $output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href=":url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', array(':url' => \Drupal::url('config.import_full'))) . '</dd>';
          $output .= '<dt>' . t('Synchronizing configuration'). '</dt>';
          $output .= '<dd>' . t('You can review differences between the active configuration and an imported configuration archive on the <a href=":synchronize">Synchronize</a> page to ensure that the changes are as expected, before finalizing the import. The Synchronize page also shows configuration items that would be added or removed.', array(':synchronize' => \Drupal::url('config.sync'))) . '</dd>';
          $output .= '<dt>' . t('Exporting a single configuration item') . '</dt>';
          $output .= '<dd>' . t('You can export a single configuration item by selecting a <em>Configuration type</em> and <em>Configuration name</em> on the <a href=":single-export">Single export</a> page. The configuration and its corresponding <em>*.yml file name</em> are then displayed on the page for you to copy.', array(':single-export' => \Drupal::url('config.export_single'))) . '</dd>';
          $output .= '<dt>' . t('Importing a single configuration item') . '</dt>';
          $output .= '<dd>' . t('You can import a single configuration item by pasting it in YAML format into the form on the <a href=":single-import">Single import</a> page.', array(':single-import' => \Drupal::url('config.import_single'))) . '</dd>';
          $output .= '</dl>';
          return $output;
    
        case 'config.sync':
          $output = '';
          $output .= '<p>' . t('Compare the configuration uploaded to your sync directory with the active configuration before completing the import.') . '</p>';
          return $output;
    
        case 'config.export_full':
          $output = '';
          $output .= '<p>' . t('Export and download the full configuration of this site as a gzipped tar file.') . '</p>';
          return $output;
    
        case 'config.import_full':
          $output = '';
          $output .= '<p>' . t('Upload a full site configuration archive to the sync directory. It can then be compared and imported on the Synchronize page.') . '</p>';
          return $output;
    
        case 'config.export_single':
          $output = '';
          $output .= '<p>' . t('Choose a configuration item to display its YAML structure.') . '</p>';
          return $output;
    
        case 'config.import_single':
          $output = '';
          $output .= '<p>' . t('Import a single configuration item by pasting its YAML structure into the text field.') . '</p>';
          return $output;
      }
    }
    
    /**
     * Implements hook_file_download().
     */
    function config_file_download($uri) {
      $scheme = file_uri_scheme($uri);
      $target = file_uri_target($uri);
      if ($scheme == 'temporary' && $target == 'config.tar.gz') {
        $request = \Drupal::request();
        $date = DateTime::createFromFormat('U', $request->server->get('REQUEST_TIME'));
        $date_string = $date->format('Y-m-d-H-i');
        $hostname = str_replace('.', '-', $request->getHttpHost());
        $filename = 'config' . '-' . $hostname . '-' . $date_string. '.tar.gz';
        $disposition = 'attachment; filename="' . $filename . '"';
        return array(
          'Content-disposition' => $disposition,
        );
      }
    }