Function __global->get_hook_ob

Definitions

sources/zones.php

  • Get the specified hook implementation object and fail if it does not exist.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: object

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$type ID_TEXT No No required parameter N/A N/A The type of hook
$subtype ID_TEXT No No required parameter N/A N/A The hook sub-type to find hook implementations for (e.g. the name of a module)
$hook ID_TEXT No No required parameter N/A N/A The name of the hook
$classname_prefix string No No required parameter N/A N/A The hook class-name prefix, the classes are named {$classname_prefix}{$hook}
$fail_ok boolean No No False N/A N/A Whether to return null opposed to failing if the hook or its object does not exist

Returns

  • The hook implementation object (null: hook was not found and $fail_ok was true)
  • Type: ?object
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get the specified hook implementation object and fail if it does not exist.
 *
 * @param  ID_TEXT $type The type of hook
 * @param  ID_TEXT $subtype The hook sub-type to find hook implementations for (e.g. the name of a module)
 * @param  ID_TEXT $hook The name of the hook
 * @param  string $classname_prefix The hook class-name prefix, the classes are named {$classname_prefix}{$hook}
 * @param  boolean $fail_ok Whether to return null opposed to failing if the hook or its object does not exist
 * @return ?object The hook implementation object (null: hook was not found and $fail_ok was true)
 */

function get_hook_ob(string $type, string $subtype, string $hook, string $classname_prefix, bool $fail_ok = false) : ?object