function module_builder_extract_hook_data in Module Builder 5
Extracts hook information based on type parameter.
Parameters
string $path: Path to hook file
string $file: Name of hook file
string $type: Type of hook data to extract. This is one of three values:
- 1 - MODULE_BUILDER_HOOK_DESCRIPTIONS: Each hook's user-friendly description
- 2 - MODULE_BUILDER_HOOK_DECLARATIONS: Each hook's entire function declaration
- 3 - MODULE_BUILDER_HOOK_NAMES: The names of each hook
Return value
array Array of hook data
1 call to module_builder_extract_hook_data()
- module_builder_get_hook_data in ./
module_builder.module - Retrieves hook data from downloaded files.
File
- ./
module_builder.module, line 1081 - Builds scaffolding for custom modules.
Code
function module_builder_extract_hook_data($path, $file, $type = MODULE_BUILDER_HOOK_NAMES) {
$contents = file_get_contents($path . $file);
// This match contains three sub-patterns, each corresponding to a constant which
// describes which data to extract
preg_match_all(MODULE_BUILDER_EXTRACT_HOOK_PATTERN, $contents, $matches);
return $matches[$type];
}