trait DrupalKernelTrait (View source)

Common functionality for overridden kernels.

Properties

protected ServiceModifierInterface[] $serviceModifiers

Methods

addServiceModifier(ServiceModifierInterface $serviceModifier)

Add a service modifier to the container builder.

getContainerBuilder()

No description

ContainerInterface
initializeContainer()

Initializes the service container.

discoverServiceProviders()

{@inheritdoc}

addModuleDrushServiceProvider($module, $filename)

Determine whether or not the Drush services.yml file is applicable for this version of Drush.

findModuleDrushServiceProvider($module, $dir)

No description

findDefaultServicesFile($module, $dir)

No description

findModuleDrushServiceProviderFromComposer($dir)

In composer.json, the Drush version constraints will appear in the 'extra' section like so:

findAppropriateServicesFile($module, $services, $dir)

No description

addDrushServiceProvider($serviceProviderName, $serviceYmlPath)

Add a services.yml file if it exists.

Details

addServiceModifier(ServiceModifierInterface $serviceModifier)

Add a service modifier to the container builder.

The container is not compiled until $kernel->boot(), so there is a chance for clients to add compiler passes et. al. before then.

Parameters

ServiceModifierInterface $serviceModifier

protected getContainerBuilder()

protected ContainerInterface initializeContainer()

Initializes the service container.

Return Value

ContainerInterface

protected shouldDrushInvalidateContainer()

discoverServiceProviders()

{@inheritdoc}

protected addModuleDrushServiceProvider($module, $filename)

Determine whether or not the Drush services.yml file is applicable for this version of Drush.

Parameters

$module
$filename

protected findModuleDrushServiceProvider($module, $dir)

Parameters

$module
$dir

protected findDefaultServicesFile($module, $dir)

Parameters

$module
$dir

protected findModuleDrushServiceProviderFromComposer($dir)

In composer.json, the Drush version constraints will appear in the 'extra' section like so:

"extra": { "drush": { "services": { "drush.services.yml": "^9" } } }

There may be multiple drush service files listed; the first one that has a version constraint that matches the Drush version is used.

Parameters

$dir

protected findAppropriateServicesFile($module, $services, $dir)

Parameters

$module
$services
$dir

protected addDrushServiceProvider($serviceProviderName, $serviceYmlPath)

Add a services.yml file if it exists.

Parameters

$serviceProviderName
$serviceYmlPath