- <?php
-
- * Implements hook_permission().
- */
- function module_test_permission() {
- return array(
- 'module_test perm' => t('example perm for module_test module'),
- );
- }
-
- * Implements hook_system_info_alter().
- *
- * Manipulate module dependencies to test dependency chains.
- */
- function module_test_system_info_alter(&$info, $file, $type) {
- if (state_get('dependency_test', FALSE) == 'missing dependency') {
- if ($file->name == 'dependency_test3') {
-
- $info['dependencies'][] = 'dependency_test2';
- }
- elseif ($file->name == 'dependency_test2') {
-
- $info['dependencies'][] = 'foo';
- }
- }
- elseif (state_get('dependency_test', FALSE) == 'dependency') {
- if ($file->name == 'dependency_test3') {
-
- $info['dependencies'][] = 'dependency_test2';
- $info['hidden'] = FALSE;
- }
- elseif ($file->name == 'dependency_test2') {
-
- $info['dependencies'][] = 'dependency_test1';
- $info['hidden'] = FALSE;
- }
- elseif ($file->name == 'dependency_test1') {
- $info['hidden'] = FALSE;
- }
- }
- elseif (state_get('dependency_test', FALSE) == 'version dependency') {
- if ($file->name == 'dependency_test3') {
-
- $info['dependencies'][] = 'dependency_test2';
- }
- elseif ($file->name == 'dependency_test2') {
-
- $info['dependencies'][] = 'dependency_test1 (1.x)';
- }
- elseif ($file->name == 'dependency_test1') {
-
- $info['version'] = '1.x-1.0';
- }
- }
- if ($file->name == 'seven' && $type == 'theme') {
- $info['regions']['test_region'] = t('Test region');
- }
- }
-
- * Implements hook_hook_info().
- */
- function module_test_hook_info() {
- $hooks['test_hook'] = array(
- 'group' => 'file',
- );
- return $hooks;
- }
-
- * Implements hook_menu().
- */
- function module_test_menu() {
- $items['module-test/hook-dynamic-loading-invoke'] = array(
- 'title' => 'Test hook dynamic loading (invoke)',
- 'page callback' => 'module_test_hook_dynamic_loading_invoke',
- 'access arguments' => array('access content'),
- );
- $items['module-test/hook-dynamic-loading-invoke-all'] = array(
- 'title' => 'Test hook dynamic loading (invoke_all)',
- 'page callback' => 'module_test_hook_dynamic_loading_invoke_all',
- 'access arguments' => array('access content'),
- );
- return $items;
- }
-
- * Page callback for 'hook dynamic loading' test.
- *
- * If the hook is dynamically loaded correctly, the menu callback should
- * return 'success!'.
- */
- function module_test_hook_dynamic_loading_invoke() {
- $result = module_invoke('module_test', 'test_hook');
- return $result['module_test'];
- }
-
- * Page callback for 'hook dynamic loading' test.
- *
- * If the hook is dynamically loaded correctly, the menu callback should
- * return 'success!'.
- */
- function module_test_hook_dynamic_loading_invoke_all() {
- $result = module_invoke_all('test_hook');
- return $result['module_test'];
- }
-
- * Implements hook_modules_enabled().
- */
- function module_test_modules_enabled($modules) {
-
-
- state_set('test_module_enable_order', $modules);
- }
-
- * Implements hook_modules_disabled().
- */
- function module_test_modules_disabled($modules) {
-
-
- state_set('test_module_disable_order', $modules);
- }
-
- * Implements hook_modules_uninstalled().
- */
- function module_test_modules_uninstalled($modules) {
-
-
- state_set('test_module_uninstall_order', $modules);
- }
-
- * Implements hook_module_implements_alter()
- */
- function module_test_module_implements_alter(&$implementations, $hook) {
- if ($hook === 'altered_test_hook') {
-
-
- $implementations['module_test'] = 'implementations';
- }
- }