You are here

function site_settings_requirements in Site Settings and Labels 8

Warn if 'settings' is used as a key and display suite is enabled.

File

./site_settings.install, line 23
Contains install and update hooks.

Code

function site_settings_requirements($phase) {
  $requirements = [];
  if (in_array($phase, [
    'runtime',
    'update',
  ])) {

    // Get template key. We give the admin control over this in case it
    // conflicts with a particular module.
    $config = \Drupal::config('site_settings.config');
    $template_key = $config
      ->get('template_key');

    // If we are using settings as the template key.
    if ($template_key == 'settings') {

      // If Display Suite is enabled.
      if (\Drupal::moduleHandler()
        ->moduleExists('ds')) {
        $requirements['site_settings'] = [
          'title' => t('Site settings'),
          'value' => t('Your site uses Display Suite and your template key for Site Settings is "settings". This is likely to conflict with Display Suite\'s use of "settings". Please visit "/admin/config/site-settings/config".'),
          'severity' => REQUIREMENT_WARNING,
        ];
      }
    }
  }
  return $requirements;
}