class HookCollectorKeyValueWritePass

Stores hook implementations in keyvalue and clears cache.

This is done in a separate, late compiler pass to ensure that a possibly altered keyvalue service is respected.

@internal

Hierarchy

Expanded class hierarchy of HookCollectorKeyValueWritePass

See also

\Drupal\Core\Hook\HookCollectorPass::writeToContainer

2 files declare their use of HookCollectorKeyValueWritePass
CoreServiceProvider.php in core/lib/Drupal/Core/CoreServiceProvider.php
HookCollectorPassTest.php in core/tests/Drupal/KernelTests/Core/Hook/HookCollectorPassTest.php

File

core/lib/Drupal/Core/Hook/HookCollectorKeyValueWritePass.php, line 21

Namespace

Drupal\Core\Hook
View source
class HookCollectorKeyValueWritePass implements CompilerPassInterface {
  
  /**
   * {@inheritdoc}
   */
  public function process(ContainerBuilder $container) : void {
    $hookData = $container->getParameter('.hook_data');
    $keyvalue = $container->get('keyvalue')
      ->get('hook_data');
    assert($keyvalue instanceof KeyValueStoreInterface);
    $keyvalue->setMultiple($hookData);
    $container->get('cache.bootstrap')
      ->delete('hook_data');
  }

}

Members

Title Sort descending Modifiers Object type Summary
HookCollectorKeyValueWritePass::process public function

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