You are here

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:

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];
}