Umil.module remove
From phpBB Development Wiki
umil::module_remove –– Remove a module using the Umil Library.
Contents |
Description
string umil::module_remove ( mixed $class [, mixed $parent [, array $module [, mixed $include_path ]]] )
Parameters
| Parameter | Required/Default | Usage |
|---|---|---|
| class | Required | The module class: acp, mcp, or ucp |
| parent | default 0 | The parent module_id or module_langname (0 for no parent) |
| module | default '' | The module_id or module_langname of the module to remove (more information below) |
| include_path | default false | Optionally specify a custom include path (only works when using the automatic module add method) |
Return Values
Returns result or umil_end data
The $module variable
Manually specifying module info
The "manual" way. When removing the module using the manual method you may specify a string (module_langname) or an integer (module_id)
Automatically determining module info
The "automatic" way. When removing the module using the automatic method you may use the same information sent through the $data array when using the automatic method of the module_add function. Just as with the automatic add method, this will automatically find the modules listed according to the given module_basename and modes from the _info file. For more information on this method see Umil.module_add#The_.24data_array
Examples
Example #1
Remove a module named 'ACP_BOARD_SETTINGS' from the ACP->'ACP_BOARD_CONFIGURATION' category
$umil->module_remove('acp', 'ACP_BOARD_CONFIGURATION', 'ACP_BOARD_SETTINGS');
Example #2
Remove a module named with the module_id of 2 from the ACP->'ACP_BOARD_CONFIGURATION' category
This is just a quick example. Using the module_id should only be used when you are trying to remove a very specific module where there could be duplicates of it. As such you'll have to find out exactly which module_id you want to remove by doing a query to the database before using this method.
$umil->module_remove('acp', 'ACP_BOARD_CONFIGURATION', 2);
Example #3
Removing the modules from the specified data set in the includes/acp/info/acp_board.php file (just the 'settings' and 'features' modes specified in that file) from the ACP->'ACP_CAT_TEST_MOD' category
$umil->module_remove('acp', 'ACP_CAT_TEST_MOD', array(
'module_basename' => 'board',
'modes' => array('settings', 'features'),
));
Example #4
Using our own $include_path with the same data given with Example #3
$umil->module_remove('acp', 'ACP_CAT_TEST_MOD', array(
'module_basename' => 'board',
'modes' => array('settings', 'features'),
), $phpbb_root_path . 'path/to/my/info/files/');
Example #5
Removing multiple modules with a single function call
$umil->module_remove(array(
array('acp', 'ACP_BOARD_CONFIGURATION', 'ACP_BOARD_SETTINGS'),
array('acp', 'ACP_BOARD_CONFIGURATION', 2),
array('acp', 'ACP_CAT_TEST_MOD', array(
'module_basename' => 'board',
'modes' => array('settings', 'features'),
)),
array('acp', 'ACP_CAT_TEST_MOD', array(
'module_basename' => 'board',
'modes' => array('settings', 'features'),
), $phpbb_root_path . 'path/to/my/info/files/'),
));
See Also

