protected ModuleHandler::verifyImplementations(&$implementations, $hook)
Verifies an array of implementations loaded from the cache, by including the lazy-loaded $module.$group.inc, and checking function_exists().
Parameters
string[] $implementations: Implementation "group" by module name.
string $hook: The hook name.
Return value
bool TRUE, if all implementations exist. FALSE, if one or more implementations don't exist and need to be removed from the cache.
File
- core/lib/Drupal/Core/Extension/ModuleHandler.php, line 612
Class
- ModuleHandler
- Class that manages modules in a Drupal installation.
Namespace
Drupal\Core\Extension
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | protected function verifyImplementations(& $implementations , $hook ) { $all_valid = TRUE; foreach ( $implementations as $module => $group ) { // If this hook implementation is stored in a lazy-loaded file, include // that file first. if ( $group ) { $this ->loadInclude( $module , 'inc' , "$module.$group" ); } // It is possible that a module removed a hook implementation without // the implementations cache being rebuilt yet, so we check whether the // function exists on each request to avoid undefined function errors. // Since ModuleHandler::implementsHook() may needlessly try to // load the include file again, function_exists() is used directly here. if (!function_exists( $module . '_' . $hook )) { // Clear out the stale implementation from the cache and force a cache // refresh to forget about no longer existing hook implementations. unset( $implementations [ $module ]); // One of the implementations did not exist and needs to be removed in // the cache. $all_valid = FALSE; } } return $all_valid ; } |
Please login to continue.