class TestingSiteConfigHooks

Same name and namespace in other branches
  1. main core/profiles/tests/testing_site_config/src/Hook/TestingSiteConfigHooks.php \Drupal\testing_site_config\Hook\TestingSiteConfigHooks

Simulates a hook class with a dependency chain requiring the kernel.

During an interactive site installation, if 'Check for updates automatically' is checked, the update module will be installed in the submit handler of the site configure form. After that, the user 1 entity is loaded to be populated with values from the form. This leads to hook implementations (the user_load hook in this instance) to be called. However, since the container was rebuilt when the update module was installed, all the service properties in SiteConfigureForm, such as entityTypeManager, need to re-populated from the newly-built container, otherwise they will reference outdated objects and cause exceptions.

Hierarchy

Expanded class hierarchy of TestingSiteConfigHooks

See also

\Drupal\Core\Installer\Form\SiteConfigureForm::submitForm()

File

core/profiles/tests/testing_site_config/src/Hook/TestingSiteConfigHooks.php, line 25

Namespace

Drupal\testing_site_config\Hook
View source
class TestingSiteConfigHooks {
  public function __construct(#[Autowire(service: 'kernel')] protected $kernel) {
  }
  public function userLoad() : void {
    assert(isset($this->kernel));
  }

}

Members

Title Sort descending Modifiers Object type Summary
TestingSiteConfigHooks::userLoad public function #[Hook('user_load')]
TestingSiteConfigHooks::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.