Loading core/lib/Drupal/Core/Asset/AssetResolver.php +4 −3 Original line number Diff line number Diff line Loading @@ -312,9 +312,10 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { if ($settings_required && $settings_have_changed) { $settings = $this->getJsSettingsAssets($assets); // Allow modules to add cached JavaScript settings. $this->moduleHandler->invokeAllWith('js_settings_build', function (callable $hook, string $module) use (&$settings, $assets) { $hook($settings, $assets); }); foreach ($this->moduleHandler->getImplementations('js_settings_build') as $module) { $function = $module . '_js_settings_build'; $function($settings, $assets); } } $settings_in_header = in_array('core/drupalSettings', $header_js_libraries); $this->cache->set($cid, [$js_assets_header, $js_assets_footer, $settings, $settings_in_header], CacheBackendInterface::CACHE_PERMANENT, ['library_info']); Loading core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +1 −1 Original line number Diff line number Diff line Loading @@ -366,7 +366,7 @@ protected function parseLibraryInfo($extension, $path) { // Allow modules to add dynamic library definitions. $hook = 'library_info_build'; if ($this->moduleHandler->hasImplementations($hook, $extension)) { if ($this->moduleHandler->implementsHook($extension, $hook)) { $libraries = NestedArray::mergeDeep($libraries, $this->moduleHandler->invoke($extension, $hook)); } Loading core/lib/Drupal/Core/Cron.php +4 −3 Original line number Diff line number Diff line Loading @@ -229,7 +229,8 @@ protected function invokeCronHandlers() { $logger = $time_logging_enabled ? $this->logger : new NullLogger(); // Iterate through the modules calling their cron handlers (if any): $this->moduleHandler->invokeAllWith('cron', function (callable $hook, string $module) use (&$module_previous, $logger) { foreach ($this->moduleHandler->getImplementations('cron') as $module) { if (!$module_previous) { $logger->info('Starting execution of @module_cron().', [ '@module' => $module, Loading @@ -246,7 +247,7 @@ protected function invokeCronHandlers() { // Do not let an exception thrown by one module disturb another. try { $hook(); $this->moduleHandler->invoke($module, 'cron'); } catch (\Exception $e) { watchdog_exception('cron', $e); Loading @@ -254,7 +255,7 @@ protected function invokeCronHandlers() { Timer::stop('cron_' . $module); $module_previous = $module; }); } if ($module_previous) { $logger->info('Execution of @module_previous_cron() took @time.', [ '@module_previous' => $module_previous, Loading core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +8 −12 Original line number Diff line number Diff line Loading @@ -862,19 +862,15 @@ protected function invokeTranslationHooks(ContentEntityInterface $entity) { protected function invokeStorageLoadHook(array &$entities) { if (!empty($entities)) { // Call hook_entity_storage_load(). $this->moduleHandler()->invokeAllWith( 'entity_storage_load', function (callable $hook, string $module) use (&$entities) { $hook($entities, $this->entityTypeId); foreach ($this->moduleHandler()->getImplementations('entity_storage_load') as $module) { $function = $module . '_entity_storage_load'; $function($entities, $this->entityTypeId); } ); // Call hook_TYPE_storage_load(). $this->moduleHandler()->invokeAllWith( $this->entityTypeId . '_storage_load', function (callable $hook, string $module) use (&$entities) { $hook($entities); foreach ($this->moduleHandler()->getImplementations($this->entityTypeId . '_storage_load') as $module) { $function = $module . '_' . $this->entityTypeId . '_storage_load'; $function($entities); } ); } } Loading core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php +4 −6 Original line number Diff line number Diff line Loading @@ -342,12 +342,10 @@ public function fieldAccess($operation, FieldDefinitionInterface $field_definiti // Invoke hook and collect grants/denies for field access from other // modules. $grants = []; $this->moduleHandler()->invokeAllWith( 'entity_field_access', function (callable $hook, string $module) use ($operation, $field_definition, $account, $items, &$grants) { $grants[] = [$module => $hook($operation, $field_definition, $account, $items)]; $hook_implementations = $this->moduleHandler()->getImplementations('entity_field_access'); foreach ($hook_implementations as $module) { $grants[] = [$module => $this->moduleHandler()->invoke($module, 'entity_field_access', [$operation, $field_definition, $account, $items])]; } ); // Our default access flag is masked under the ':default' key. $grants = array_merge([':default' => $default], ...$grants); Loading Loading
core/lib/Drupal/Core/Asset/AssetResolver.php +4 −3 Original line number Diff line number Diff line Loading @@ -312,9 +312,10 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { if ($settings_required && $settings_have_changed) { $settings = $this->getJsSettingsAssets($assets); // Allow modules to add cached JavaScript settings. $this->moduleHandler->invokeAllWith('js_settings_build', function (callable $hook, string $module) use (&$settings, $assets) { $hook($settings, $assets); }); foreach ($this->moduleHandler->getImplementations('js_settings_build') as $module) { $function = $module . '_js_settings_build'; $function($settings, $assets); } } $settings_in_header = in_array('core/drupalSettings', $header_js_libraries); $this->cache->set($cid, [$js_assets_header, $js_assets_footer, $settings, $settings_in_header], CacheBackendInterface::CACHE_PERMANENT, ['library_info']); Loading
core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +1 −1 Original line number Diff line number Diff line Loading @@ -366,7 +366,7 @@ protected function parseLibraryInfo($extension, $path) { // Allow modules to add dynamic library definitions. $hook = 'library_info_build'; if ($this->moduleHandler->hasImplementations($hook, $extension)) { if ($this->moduleHandler->implementsHook($extension, $hook)) { $libraries = NestedArray::mergeDeep($libraries, $this->moduleHandler->invoke($extension, $hook)); } Loading
core/lib/Drupal/Core/Cron.php +4 −3 Original line number Diff line number Diff line Loading @@ -229,7 +229,8 @@ protected function invokeCronHandlers() { $logger = $time_logging_enabled ? $this->logger : new NullLogger(); // Iterate through the modules calling their cron handlers (if any): $this->moduleHandler->invokeAllWith('cron', function (callable $hook, string $module) use (&$module_previous, $logger) { foreach ($this->moduleHandler->getImplementations('cron') as $module) { if (!$module_previous) { $logger->info('Starting execution of @module_cron().', [ '@module' => $module, Loading @@ -246,7 +247,7 @@ protected function invokeCronHandlers() { // Do not let an exception thrown by one module disturb another. try { $hook(); $this->moduleHandler->invoke($module, 'cron'); } catch (\Exception $e) { watchdog_exception('cron', $e); Loading @@ -254,7 +255,7 @@ protected function invokeCronHandlers() { Timer::stop('cron_' . $module); $module_previous = $module; }); } if ($module_previous) { $logger->info('Execution of @module_previous_cron() took @time.', [ '@module_previous' => $module_previous, Loading
core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +8 −12 Original line number Diff line number Diff line Loading @@ -862,19 +862,15 @@ protected function invokeTranslationHooks(ContentEntityInterface $entity) { protected function invokeStorageLoadHook(array &$entities) { if (!empty($entities)) { // Call hook_entity_storage_load(). $this->moduleHandler()->invokeAllWith( 'entity_storage_load', function (callable $hook, string $module) use (&$entities) { $hook($entities, $this->entityTypeId); foreach ($this->moduleHandler()->getImplementations('entity_storage_load') as $module) { $function = $module . '_entity_storage_load'; $function($entities, $this->entityTypeId); } ); // Call hook_TYPE_storage_load(). $this->moduleHandler()->invokeAllWith( $this->entityTypeId . '_storage_load', function (callable $hook, string $module) use (&$entities) { $hook($entities); foreach ($this->moduleHandler()->getImplementations($this->entityTypeId . '_storage_load') as $module) { $function = $module . '_' . $this->entityTypeId . '_storage_load'; $function($entities); } ); } } Loading
core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php +4 −6 Original line number Diff line number Diff line Loading @@ -342,12 +342,10 @@ public function fieldAccess($operation, FieldDefinitionInterface $field_definiti // Invoke hook and collect grants/denies for field access from other // modules. $grants = []; $this->moduleHandler()->invokeAllWith( 'entity_field_access', function (callable $hook, string $module) use ($operation, $field_definition, $account, $items, &$grants) { $grants[] = [$module => $hook($operation, $field_definition, $account, $items)]; $hook_implementations = $this->moduleHandler()->getImplementations('entity_field_access'); foreach ($hook_implementations as $module) { $grants[] = [$module => $this->moduleHandler()->invoke($module, 'entity_field_access', [$operation, $field_definition, $account, $items])]; } ); // Our default access flag is masked under the ':default' key. $grants = array_merge([':default' => $default], ...$grants); Loading