function module_load_install

Same name in other branches
  1. 7.x includes/module.inc \module_load_install()
  2. 8.9.x core/includes/module.inc \module_load_install()

Loads a module's installation hooks.

Parameters

$module: The name of the module (without the .module extension).

Return value

bool|string The name of the module's install file, if successful; FALSE otherwise.

Deprecated

in drupal:9.4.0 and is removed from drupal:10.0.0. Use \Drupal::moduleHandler()->loadInclude($module, 'install') instead. Note, the replacement no longer allows including code from uninstalled modules.

See also

https://www.drupal.org/node/3220952

2 calls to module_load_install()
drupal_get_module_schema in core/includes/schema.inc
Returns a module's schema.
ModuleLegacyTest::testModuleLoadInstall in core/tests/Drupal/KernelTests/Core/Extension/ModuleLegacyTest.php
Test deprecation of module_load_install() function.

File

core/includes/module.inc, line 25

Code

function module_load_install($module) {
    @trigger_error('module_load_install() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead, you should use \\Drupal::moduleHandler()->loadInclude($module, \'install\'). Note, the replacement no longer allows including code from uninstalled modules. See https://www.drupal.org/project/drupal/issues/2010380', E_USER_DEPRECATED);
    // Make sure the installation API is available
    include_once __DIR__ . '/install.inc';
    if (\Drupal::hasService('extension.list.module')) {
        
        /** @var \Drupal\Core\Extension\ModuleExtensionList $module_list */
        $module_list = \Drupal::service('extension.list.module');
        $file = DRUPAL_ROOT . '/' . $module_list->getPath($module) . "/{$module}.install";
        if (is_file($file)) {
            require_once $file;
            return $file;
        }
    }
    return FALSE;
}

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