You are here

class TwigExtensionsServiceProvider in Twig Extensions 8

Same name and namespace in other branches
  1. 8.2 src/TwigExtensionsServiceProvider.php \Drupal\twig_extensions\TwigExtensionsServiceProvider

Registers the twig services.

Hierarchy

Expanded class hierarchy of TwigExtensionsServiceProvider

File

src/TwigExtensionsServiceProvider.php, line 11

Namespace

Drupal\twig_extensions
View source
class TwigExtensionsServiceProvider extends ServiceProviderBase {

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

    // Ensure the Intl PHP extension is available before adding the service.
    if (class_exists('IntlDateFormatter')) {
      $container
        ->register('twig_extensions.twig.intl', '\\Twig_Extensions_Extension_Intl')
        ->addTag('twig.extension');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ServiceProviderBase::alter public function Modifies existing service definitions. Overrides ServiceModifierInterface::alter 5
TwigExtensionsServiceProvider::register public function Registers services to the container. Overrides ServiceProviderBase::register