function ModuleInstaller::invoke
Call a procedural hook in an installed module during installation.
Hooks called during install will remain procedural.
- hook_install()
- hook_install_tasks()
- hook_install_tasks_alter()
- hook_post_update_NAME()
- hook_schema()
- hook_uninstall()
- hook_update_last_removed()
- hook_update_N()
Parameters
string $module: The module (it can be a profile, too).
string $hook: The name of the hook to invoke.
array $args: Arguments to pass to the hook.
Return value
mixed The return value of the procedural hook. Defaults to NULL if a hook function does not exist.
4 calls to ModuleInstaller::invoke()
- ModuleInstaller::doInstall in core/
lib/ Drupal/ Core/ Extension/ ModuleInstaller.php - Installs a set of modules.
- ModuleInstaller::installSchema in core/
lib/ Drupal/ Core/ Extension/ ModuleInstaller.php - Creates all tables defined in a module's hook_schema().
- ModuleInstaller::uninstall in core/
lib/ Drupal/ Core/ Extension/ ModuleInstaller.php - ModuleInstaller::uninstallSchema in core/
lib/ Drupal/ Core/ Extension/ ModuleInstaller.php - Removes all tables defined in a module's hook_schema().
File
-
core/
lib/ Drupal/ Core/ Extension/ ModuleInstaller.php, line 827
Class
- ModuleInstaller
- Default implementation of the module installer.
Namespace
Drupal\Core\ExtensionCode
protected function invoke(string $module, string $hook, array $args = []) : mixed {
$function = $module . '_' . $hook;
return function_exists($function) ? $function(...$args) : NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.