You are here

ConfigReadonlyServiceProvider.php in Configuration Read-only mode 7

File

lib/Drupal/config_readonly/ConfigReadonlyServiceProvider.php
View source
<?php

/**
 * @file
 * Contains \Drupal\config_readonly\ConfigReadonlyServiceProvider.
 */
namespace Drupal\config_readonly;

use Symfony\Component\DependencyInjection\Reference;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceModifierInterface;
use Drupal\Core\DependencyInjection\ServiceProviderInterface;

/**
 * Overrides CMI storage.
 */
class ConfigReadonlyServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {
  }

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    if ($container
      ->getParameter('kernel.environment') !== 'install') {
      $definition = $container
        ->getDefinition('config.storage');
      $definition
        ->setClass('Drupal\\config_readonly\\Config\\ConfigReadonlyStorage');
    }
  }

}

Classes

Namesort descending Description
ConfigReadonlyServiceProvider Overrides CMI storage.