Skip to content

Instantly share code, notes, and snippets.

@mirie
Created September 7, 2016 21:02
Show Gist options
  • Save mirie/d5c5566522b1353e949b25f86f94c82b to your computer and use it in GitHub Desktop.
Save mirie/d5c5566522b1353e949b25f86f94c82b to your computer and use it in GitHub Desktop.
Example: D8 - Remove a service definition. Put in src directory of a module.
<?php
namespace Drupal\myModule;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
/**
* Removes the internationalization service definitions from twig_extension.
*/
class myModuleServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
$container->removeDefinition('twig_extensions.twig.i18n');
$container->removeDefinition('twig_extensions.twig.intl');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment