Commit d3c5919d authored by catch's avatar catch

Issue #2045919 by drupalrv: Replace all module_implements() deprecated function calls.

parent 29c09eff
......@@ -1579,7 +1579,7 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG
}
// Call the logging hooks to log/process the message
foreach (module_implements('watchdog') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('watchdog') as $module) {
$function = $module . '_watchdog';
$function($log_entry);
}
......
......@@ -3247,7 +3247,7 @@ function drupal_cron_run() {
}
// Iterate through the modules calling their cron handlers (if any):
foreach (module_implements('cron') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('cron') as $module) {
// Do not let an exception thrown by one module disturb another.
try {
module_invoke($module, 'cron');
......@@ -3637,7 +3637,7 @@ function drupal_render_page($page) {
}
// Modules can add elements to $page as needed in hook_page_build().
foreach (module_implements('page_build') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('page_build') as $module) {
$function = $module . '_page_build';
$function($page);
}
......
......@@ -1746,7 +1746,7 @@ function menu_get_active_help() {
$arg = drupal_help_arg(arg(NULL));
foreach (module_implements('help') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('help') as $module) {
$function = $module . '_help';
// Lookup help for this path.
if ($help = $function($router_path, $arg)) {
......@@ -2753,7 +2753,7 @@ function menu_router_build($save = FALSE) {
// We need to manually call each module so that we can know which module
// a given item came from.
$callbacks = array();
foreach (module_implements('menu') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('menu') as $module) {
$router_items = call_user_func($module . '_menu');
if (isset($router_items) && is_array($router_items)) {
foreach (array_keys($router_items) as $path) {
......
......@@ -81,7 +81,7 @@ function drupal_get_complete_schema($rebuild = FALSE) {
require_once __DIR__ . '/common.inc';
// Invoke hook_schema for all modules.
foreach (module_implements('schema') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('schema') as $module) {
// Cast the result of hook_schema() to an array, as a NULL return value
// would cause array_merge() to set the $schema variable to NULL as well.
// That would break modules which use $schema further down the line.
......
......@@ -609,7 +609,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
$cache = $cached->data;
}
else {
foreach (module_implements('theme') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('theme') as $module) {
_theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
}
// Only cache this registry if all modules are loaded.
......
......@@ -293,7 +293,7 @@ protected function buildQuery($ids, $revision_id = FALSE) {
*/
protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
// Call hook_entity_load().
foreach (module_implements('entity_load') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) {
$function = $module . '_entity_load';
$function($queried_entities, $this->entityType);
}
......@@ -301,7 +301,7 @@ protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
// always the queried entities, followed by additional arguments set in
// $this->hookLoadArguments.
$args = array_merge(array($queried_entities), $this->hookLoadArguments);
foreach (module_implements($this->entityType . '_load') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) {
call_user_func_array($module . '_' . $this->entityType . '_load', $args);
}
}
......
......@@ -346,7 +346,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
}
// Call hook_entity_load().
foreach (module_implements('entity_load') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) {
$function = $module . '_entity_load';
$function($queried_entities, $this->entityType);
}
......@@ -354,7 +354,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
// always the queried entities, followed by additional arguments set in
// $this->hookLoadArguments.
$args = array_merge(array($queried_entities), $this->hookLoadArguments);
foreach (module_implements($this->entityType . '_load') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) {
call_user_func_array($module . '_' . $this->entityType . '_load', $args);
}
}
......
......@@ -45,7 +45,7 @@ public function getDefinition($plugin_id) {
*/
public function getDefinitions() {
$definitions = array();
foreach (module_implements($this->hook) as $module) {
foreach (\Drupal::moduleHandler()->getImplementations($this->hook) as $module) {
$function = $module . '_' . $this->hook;
foreach ($function() as $plugin_id => $definition) {
$definition['module'] = $module;
......
......@@ -54,7 +54,7 @@ public function getDefinition($plugin_id) {
*/
public function getDefinitions() {
$definitions = $this->decorated->getDefinitions();
foreach (module_implements($this->hook) as $module) {
foreach (\Drupal::moduleHandler()->getImplementations($this->hook) as $module) {
$function = $module . '_' . $this->hook;
$function($definitions);
}
......
......@@ -290,7 +290,7 @@ function _block_get_renderable_region($list = array()) {
// chances of having unwanted output get in the cache and later be served
// to other users. We therefore exclude user 1 from block caching.
$not_cacheable = $GLOBALS['user']->id() == 1 ||
count(module_implements('node_grants')) ||
count(Drupal::moduleHandler()->getImplementations('node_grants')) ||
!\Drupal::request()->isMethodSafe();
foreach ($list as $key => $block) {
......
......@@ -73,7 +73,7 @@ public function entityQueryAlter(SelectInterface $query) {
// Passing the query to node_query_node_access_alter() is sadly
// insufficient for nodes.
// @see SelectionEntityTypeNode::entityQueryAlter()
if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
if (!user_access('bypass node access') && !count(\Drupal::moduleHandler()->getImplementations('node_grants'))) {
$query->condition($node_alias . '.status', 1);
}
}
......
......@@ -519,7 +519,7 @@ function field_attach_form(EntityInterface $entity, &$form, &$form_state, $langc
// Let other modules make changes to the form.
// Avoid module_invoke_all() to let parameters be taken by reference.
foreach (module_implements('field_attach_form') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_attach_form') as $module) {
$function = $module . '_field_attach_form';
$function($entity, $form, $form_state, $langcode);
}
......@@ -621,7 +621,7 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $
// Invoke hook_field_storage_pre_load(): let any module load field
// data before the storage engine, accumulating along the way.
$skip_fields = array();
foreach (module_implements('field_storage_pre_load') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_storage_pre_load') as $module) {
$function = $module . '_field_storage_pre_load';
$function($entity_type, $queried_entities, $age, $skip_fields, $hook_options);
}
......@@ -824,7 +824,7 @@ function field_attach_extract_form_values(EntityInterface $entity, $form, &$form
// Let other modules act on submitting the entity.
// Avoid module_invoke_all() to let $form_state be taken by reference.
foreach (module_implements('field_attach_extract_form_values') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_attach_extract_form_values') as $module) {
$function = $module . 'field_attach_extract_form_values';
$function($entity, $form, $form_state);
}
......@@ -853,7 +853,7 @@ function field_attach_insert(EntityInterface $entity) {
// Let any module insert field data before the storage engine, accumulating
// saved fields along the way.
$skip_fields = array();
foreach (module_implements('field_storage_pre_insert') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_storage_pre_insert') as $module) {
$function = $module . '_field_storage_pre_insert';
$function($entity, $skip_fields);
}
......@@ -894,7 +894,7 @@ function field_attach_update(EntityInterface $entity) {
// Let any module update field data before the storage engine, accumulating
// saved fields along the way.
$skip_fields = array();
foreach (module_implements('field_storage_pre_update') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_storage_pre_update') as $module) {
$function = $module . '_field_storage_pre_update';
$function($entity, $skip_fields);
}
......
......@@ -323,7 +323,7 @@ function field_purge_data(EntityInterface $entity, $field, $instance) {
module_invoke($field['storage']['module'], 'field_storage_purge', $entity, $field, $instance);
// Let other modules act on purging the data.
foreach (module_implements('field_attach_purge') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_attach_purge') as $module) {
$function = $module . '_field_attach_purge';
$function($entity, $field, $instance);
}
......
......@@ -83,7 +83,7 @@ function _field_info_collate_types() {
);
// Populate storage types.
foreach (module_implements('field_storage_info') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_storage_info') as $module) {
$storage_types = (array) module_invoke($module, 'field_storage_info');
foreach ($storage_types as $name => $storage_info) {
// Provide defaults.
......
......@@ -145,7 +145,7 @@ function field_help($path, $arg) {
// order by displayed module name (module names are not translated).
$items = array();
$info = system_get_info('module');
$modules = array_merge(module_implements('field_info'), module_implements('field_widget_info'));
$modules = array_merge(Drupal::moduleHandler()->getImplementations('field_info'), Drupal::moduleHandler()->getImplementations('field_widget_info'));
$modules = array_unique($modules);
sort($modules);
foreach ($modules as $module) {
......@@ -873,7 +873,7 @@ function field_access($op, FieldInterface $field, $entity_type, $entity = NULL,
$account = $user;
}
foreach (module_implements('field_access') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('field_access') as $module) {
$function = $module . '_field_access';
$access = $function($op, $field, $entity_type, $entity, $account);
if ($access === FALSE) {
......
......@@ -56,7 +56,8 @@ public function getDefinition($plugin_id) {
public function getDefinitions() {
$definitions = $this->decorated->getDefinitions();
// We cannot use HookDiscovery, since it uses module_implements(), which
// We cannot use HookDiscovery, since it uses
// Drupal::moduleHandler()->getImplementations(), which
// throws exceptions during upgrades.
foreach (array_keys($this->moduleHandler->getModuleList()) as $module) {
$function = $module . '_field_info';
......
......@@ -660,7 +660,7 @@ function file_file_download($uri, $field_type = 'file') {
// Invoke hook and collect grants/denies for download access.
// Default to FALSE and let entities overrule this ruling.
$grants = array('system' => FALSE);
foreach (module_implements('file_download_access') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('file_download_access') as $module) {
$grants = array_merge($grants, array($module => module_invoke($module, 'file_download_access', $field, $entity, $file)));
}
// Allow other modules to alter the returned grants/denies.
......
......@@ -16,7 +16,7 @@ function help_menu() {
'weight' => 9,
);
$modules = module_implements('help');
$modules = Drupal::moduleHandler()->getImplementations('help');
ksort($modules);
foreach ($modules as $module) {
$items['admin/help/' . $module] = array(
......
......@@ -108,7 +108,7 @@ protected function verifyHelp($response = 200) {
protected function getModuleList() {
$modules = array();
$module_data = system_rebuild_module_data();
foreach (module_implements('help') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('help') as $module) {
$modules[$module] = $module_data[$module]->info['name'];
}
return $modules;
......
......@@ -349,7 +349,7 @@ public function validate(array $form, array &$form_state) {
// Invoke hook_node_validate() for validation needed by modules.
// Can't use module_invoke_all(), because $form_state must
// be receivable by reference.
foreach (module_implements('node_validate') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('node_validate') as $module) {
$function = $module . '_node_validate';
$function($node, $form, $form_state);
}
......@@ -376,7 +376,7 @@ public function submit(array $form, array &$form_state) {
}
node_submit($node);
foreach (module_implements('node_submit') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('node_submit') as $module) {
$function = $module . '_node_submit';
$function($node, $form, $form_state);
}
......
......@@ -58,7 +58,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
$this->hookLoadArguments = array($argument);
// Call hook_entity_load().
foreach (module_implements('entity_load') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) {
$function = $module . '_entity_load';
$function($queried_entities, $this->entityType);
}
......@@ -66,7 +66,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
// always the queried entities, followed by additional arguments set in
// $this->hookLoadArguments.
$args = array_merge(array($queried_entities), $this->hookLoadArguments);
foreach (module_implements($this->entityType . '_load') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) {
call_user_func_array($module . '_' . $this->entityType . '_load', $args);
}
}
......
......@@ -34,7 +34,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
// 'unpublished'. We need to do that as long as there are no access control
// modules in use on the site. As long as one access control module is there,
// it is supposed to handle this check.
if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
if (!user_access('bypass node access') && !count(\Drupal::moduleHandler()->getImplementations('node_grants'))) {
$query->condition('status', NODE_PUBLISHED);
}
return $query;
......
......@@ -2227,7 +2227,7 @@ function node_access_view_all_nodes($account = NULL) {
}
// If no modules implement the node access system, access is always TRUE.
if (!module_implements('node_grants')) {
if (!Drupal::moduleHandler()->getImplementations('node_grants')) {
$access[$account->id()] = TRUE;
}
else {
......@@ -2274,7 +2274,7 @@ function node_query_node_access_alter(AlterableInterface $query) {
if (user_access('bypass node access', $account)) {
return;
}
if (!count(module_implements('node_grants'))) {
if (!count(Drupal::moduleHandler()->getImplementations('node_grants'))) {
return;
}
if ($op == 'view' && node_access_view_all_nodes($account)) {
......@@ -2363,7 +2363,7 @@ function node_access_rebuild($batch_mode = FALSE) {
$access_controller = Drupal::entityManager()->getAccessController('node');
$access_controller->deleteGrants();
// Only recalculate if the site is using a node_access module.
if (count(module_implements('node_grants'))) {
if (count(Drupal::moduleHandler()->getImplementations('node_grants'))) {
if ($batch_mode) {
$batch = array(
'title' => t('Rebuilding content access permissions'),
......@@ -2481,7 +2481,7 @@ function node_requirements($phase) {
// in the {node_access} table, or if there are modules that
// implement hook_node_grants().
$grant_count = Drupal::entityManager()->getAccessController('node')->countGrants();
if ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
if ($grant_count != 1 || count(Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
$value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
}
else {
......@@ -2504,7 +2504,7 @@ function node_requirements($phase) {
function node_modules_enabled($modules) {
// Check if any of the newly enabled modules require the node_access table to
// be rebuilt.
if (!node_access_needs_rebuild() && array_intersect($modules, module_implements('node_grants'))) {
if (!node_access_needs_rebuild() && array_intersect($modules, Drupal::moduleHandler()->getImplementations('node_grants'))) {
node_access_needs_rebuild(TRUE);
}
}
......@@ -2528,7 +2528,7 @@ function node_modules_disabled($modules) {
// If there remains no more node_access module, rebuilding will be
// straightforward, we can do it right now.
if (node_access_needs_rebuild() && count(module_implements('node_grants')) == 0) {
if (node_access_needs_rebuild() && count(Drupal::moduleHandler()->getImplementations('node_grants')) == 0) {
node_access_rebuild();
}
}
......
......@@ -110,7 +110,7 @@ function rdf_get_namespaces() {
$namespaces = array();
// In order to resolve duplicate namespaces by using the earliest defined
// namespace, do not use module_invoke_all().
foreach (module_implements('rdf_namespaces') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('rdf_namespaces') as $module) {
$function = $module . '_rdf_namespaces';
if (function_exists($function)) {
$namespaces = NestedArray::mergeDeep($function(), $namespaces);
......
......@@ -238,7 +238,7 @@ function search_get_info($all = FALSE) {
$search_hooks = &drupal_static(__FUNCTION__);
if (!isset($search_hooks)) {
foreach (module_implements('search_info') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('search_info') as $module) {
$search_hooks[$module] = call_user_func($module . '_search_info');
// Use module name as the default value.
$search_hooks[$module] += array('title' => $module, 'path' => $module);
......@@ -537,7 +537,7 @@ function _search_index_truncate(&$text) {
* Invokes hook_search_preprocess() in modules.
*/
function search_invoke_preprocess(&$text, $langcode = NULL) {
foreach (module_implements('search_preprocess') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('search_preprocess') as $module) {
$text = module_invoke($module, 'search_preprocess', $text, $langcode);
}
}
......
......@@ -40,7 +40,7 @@ function testSetUp() {
$this->assertTrue(function_exists('entity_test_permission'), "$module.module was loaded.");
// Verify that there is a fixed module list.
$this->assertIdentical(array_keys(\Drupal::moduleHandler()->getModuleList()), array($module));
$this->assertIdentical(module_implements('permission'), array($module));
$this->assertIdentical(\Drupal::moduleHandler()->getImplementations('permission'), array($module));
// Verify that no modules have been installed.
$this->assertFalse(db_table_exists($table), "'$table' database table not found.");
......@@ -56,8 +56,8 @@ function testEnableModulesLoad() {
$this->assertFalse(module_exists($module), "$module module not found.");
$list = array_keys(\Drupal::moduleHandler()->getModuleList());
$this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list.");
$list = module_implements('permission');
$this->assertFalse(in_array($module, $list), "{$module}_permission() in module_implements() not found.");
$list = \Drupal::moduleHandler()->getImplementations('permission');
$this->assertFalse(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() not found.");
// Enable the module.
$this->enableModules(array($module));
......@@ -66,8 +66,8 @@ function testEnableModulesLoad() {
$this->assertTrue(module_exists($module), "$module module found.");
$list = array_keys(\Drupal::moduleHandler()->getModuleList());
$this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list.");
$list = module_implements('permission');
$this->assertTrue(in_array($module, $list), "{$module}_permission() in module_implements() found.");
$list = \Drupal::moduleHandler()->getImplementations('permission');
$this->assertTrue(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() found.");
}
/**
......@@ -81,8 +81,8 @@ function testEnableModulesInstall() {
$this->assertFalse(module_exists($module), "$module module not found.");
$list = array_keys(\Drupal::moduleHandler()->getModuleList());
$this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list.");
$list = module_implements('permission');
$this->assertFalse(in_array($module, $list), "{$module}_permission() in module_implements() not found.");
$list = \Drupal::moduleHandler()->getImplementations('permission');
$this->assertFalse(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() not found.");
$this->assertFalse(db_table_exists($table), "'$table' database table not found.");
$schema = drupal_get_schema($table);
......@@ -95,8 +95,8 @@ function testEnableModulesInstall() {
$this->assertTrue(module_exists($module), "$module module found.");
$list = array_keys(\Drupal::moduleHandler()->getModuleList());
$this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list.");
$list = module_implements('permission');
$this->assertTrue(in_array($module, $list), "{$module}_permission() in module_implements() found.");
$list = \Drupal::moduleHandler()->getImplementations('permission');
$this->assertTrue(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() found.");
$this->assertTrue(db_table_exists($table), "'$table' database table found.");
$schema = drupal_get_schema($table);
......
......@@ -15,7 +15,7 @@
*
* These tests can not access the database nor files. Calling any Drupal
* function that needs the database will throw exceptions. These include
* watchdog(), module_implements(), module_invoke_all() etc.
* watchdog(), Drupal::moduleHandler()->getImplementations(), module_invoke_all() etc.
*/
abstract class UnitTestBase extends TestBase {
......
......@@ -13,7 +13,8 @@
/**
* Tests for URL generation functions.
*
* url() calls module_implements(), which may issue a db query, which requires
* url() calls Drupal::moduleHandler()->getImplementations(),
* which may issue a db query, which requires
* inheriting from a web test case rather than a unit test case.
*/
class UrlTest extends WebTestBase {
......
......@@ -81,7 +81,7 @@ protected function assertModuleList(Array $expected_values, $condition) {
}
/**
* Test module_implements() caching.
* Test Drupal::moduleHandler()->getImplementations() caching.
*/
function testModuleImplements() {
// Clear the cache.
......
......@@ -258,7 +258,7 @@ public function testFindThemeTemplates() {
$cache = array();
// Prime the theme cache.
foreach (module_implements('theme') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) {
_theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
}
......
......@@ -43,7 +43,7 @@ function testTwigDebugMarkup() {
$cache = array();
// Prime the theme cache.
foreach (module_implements('theme') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) {
_theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
}
// Create array of Twig templates.
......
......@@ -84,7 +84,7 @@ function testTwigCacheOverride() {
$cache = array();
// Prime the theme cache.
foreach (module_implements('theme') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) {
_theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
}
......
......@@ -1364,9 +1364,9 @@ function hook_mail_alter(&$message) {
/**
* Alter the registry of modules implementing a hook.
*
* This hook is invoked during module_implements(). A module may implement this
* hook in order to reorder the implementing modules, which are otherwise
* ordered by the module's system weight.
* This hook is invoked during Drupal::moduleHandler()->getImplementations().
* A module may implement this hook in order to reorder the implementing
* modules, which are otherwise ordered by the module's system weight.
*
* Note that hooks invoked using drupal_alter() can have multiple variations
* (such as hook_form_alter() and hook_form_FORM_ID_alter()). drupal_alter()
......@@ -1386,7 +1386,8 @@ function hook_mail_alter(&$message) {
*/
function hook_module_implements_alter(&$implementations, $hook) {
if ($hook == 'rdf_mapping') {
// Move my_module_rdf_mapping() to the end of the list. module_implements()
// Move my_module_rdf_mapping() to the end of the list.
// Drupal::moduleHandler()->getImplementations()
// iterates through $implementations with a foreach loop which PHP iterates
// in the order that the items were added, so to move an item to the end of
// the array, we remove it and then add it.
......
......@@ -2717,7 +2717,7 @@ function system_rebuild_module_data() {
function _system_update_bootstrap_status() {
$bootstrap_modules = array();
foreach (bootstrap_hooks() as $hook) {
foreach (module_implements($hook) as $module) {
foreach (Drupal::moduleHandler()->getImplementations($hook) as $module) {
$bootstrap_modules[$module] = drupal_get_filename('module', $module);
}
}
......
......@@ -2,7 +2,7 @@
/**
* @file
* A file to test module_implements() loading includes.
* A file to test Drupal::moduleHandler()->getImplementations() loading includes.
*/
/**
......
......@@ -68,7 +68,7 @@ public function buildOptionsForm(&$form, &$form_state) {
$module_info = system_get_info('module');
// Get list of permissions
foreach (module_implements('permission') as $module) {
foreach (\Drupal::moduleHandler()->getImplementations('permission') as $module) {
$permissions = module_invoke($module, 'permission');
foreach ($permissions as $name => $perm) {
$perms[$module_info[$module]['name']][$name] = strip_tags($perm['title']);
......
......@@ -1644,7 +1644,7 @@ function user_role_load($rid) {
*/
function user_permission_get_modules() {
$permissions = array();
foreach (module_implements('permission') as $module) {
foreach (Drupal::moduleHandler()->getImplementations('permission') as $module) {
$perms = module_invoke($module, 'permission');
foreach ($perms as $key => $value) {
$permissions[$key] = $module;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment