You are here

function module_builder_get_hook_names in Module Builder 7

Same name and namespace in other branches
  1. 6.2 includes/process.inc \module_builder_get_hook_names()

Get just hook names.

Parameters

$short: Whether to return hook names as just 'init' or 'hook_init'. Might as well call like this: module_builder_get_hook_names('short') for clarity.

Return value

A flat array of strings.

2 calls to module_builder_get_hook_names()
module_builder_callback_doc_hooks in drush/module_builder.drush.inc
Callback to add doc headers to existing hooks.
module_builder_callback_doc_params in drush/module_builder.drush.inc
WORK IN PROGRESS Add function headers wherever needed with params.

File

includes/process.inc, line 62
Module builder code processing code.

Code

function module_builder_get_hook_names($dir = NULL, $short = FALSE) {
  $data = module_builder_get_hook_data_flat($dir);
  $names = array_keys($data);
  if ($short) {
    foreach ($names as $key => $hook_name) {
      $names[$key] = str_replace('hook_', '', $hook_name);
    }
  }
  return $names;
}