W3cubDocs

/Drupal 8

public function InstallerServiceProvider::alter

public InstallerServiceProvider::alter(ContainerBuilder $container)

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceModifierInterface::alter

File

core/lib/Drupal/Core/Installer/InstallerServiceProvider.php, line 67

Class

InstallerServiceProvider
Service provider for the early installer environment.

Namespace

Drupal\Core\Installer

Code

public function alter(ContainerBuilder $container) {
  // Disable Twig cache (php storage does not exist yet).
  $twig_config = $container->getParameter('twig.config');
  $twig_config['cache'] = FALSE;
  $container->setParameter('twig.config', $twig_config);

  // No service may persist when the early installer kernel is rebooted into
  // the production environment.
  // @todo The DrupalKernel reboot performed by drupal_install_system() is
  //   actually not a "regular" reboot (like ModuleHandler::install()), so
  //   services are not actually persisted.
  foreach ($container->findTaggedServiceIds('persist') as $id => $tags) {
    $definition = $container->getDefinition($id);
    $definition->clearTag('persist');
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Installer!InstallerServiceProvider.php/function/InstallerServiceProvider::alter/8.1.x