Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContainerBuilder.php

function ContainerBuilder::loadFromExtension

Loads the configuration for an extension.

Parameters

string $extension The extension alias or namespace:

array<string, mixed>|null $values An array of values that customizes the extension:

Return value

$this

Throws

BadMethodCallException When this ContainerBuilder is compiled

\LogicException if the extension is not registered

File

vendor/symfony/dependency-injection/ContainerBuilder.php, line 476

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function loadFromExtension(string $extension, ?array $values = null) : static {
    if ($this->isCompiled()) {
        throw new BadMethodCallException('Cannot load from an extension on a compiled container.');
    }
    $namespace = $this->getExtension($extension)
        ->getAlias();
    $this->extensionConfigs[$namespace][] = $values ?? [];
    return $this;
}
RSS feed
Powered by Drupal