function module_test_module_implements_alter

Same name in other branches
  1. 7.x modules/simpletest/tests/module_test.module \module_test_module_implements_alter()
  2. 9 core/modules/system/tests/modules/module_test/module_test.module \module_test_module_implements_alter()
  3. 10 core/modules/system/tests/modules/module_test/module_test.module \module_test_module_implements_alter()
  4. 11.x core/modules/system/tests/modules/module_test/module_test.module \module_test_module_implements_alter()

Implements hook_module_implements_alter()

See also

module_test_altered_test_hook()

\Drupal\system\Tests\Module\ModuleImplementsAlterTest::testModuleImplementsAlter()

File

core/modules/system/tests/modules/module_test/module_test.module, line 103

Code

function module_test_module_implements_alter(&$implementations, $hook) {
    if ($hook === 'altered_test_hook') {
        // Add a hook implementation, that will be found in
        // module_test.implementation.inc.
        $implementations['module_test'] = 'implementations';
    }
    if ($hook === 'unimplemented_test_hook') {
        // Add the non-existing function module_test_unimplemented_test_hook(). This
        // should cause an exception to be thrown in
        // \Drupal\Core\Extension\ModuleHandler::buildImplementationInfo('unimplemented_test_hook').
        $implementations['module_test'] = FALSE;
    }
}

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