Elgg  Version 3.0
Public Member Functions | List of all members
Elgg\PluginHooksService Class Reference

Plugin Hooks. More...

Inheritance diagram for Elgg\PluginHooksService:
Elgg\HooksRegistrationService

Public Member Functions

 __construct (EventsService $events)
 Constructor. More...
 
 getEvents ()
 Get the events API. More...
 
 trigger ($name, $type, $params=null, $value=null, array $options=[])
 Triggers a plugin hook. More...
 
 triggerDeprecated ($name, $type, $params=null, $value=null, $message=null, $version=null)
 Trigger an plugin hook normally, but send a notice about deprecated use if any handlers are registered. More...
 
 registerHandler ($name, $type, $callback, $priority=500)
 {} More...
 
 unregisterHandler ($name, $type, $callback)
 
- Public Member Functions inherited from Elgg\HooksRegistrationService
 registerHandler ($name, $type, $callback, $priority=500)
 Register a callback as a plugin hook handler. More...
 
 unregisterHandler ($name, $type, $callback)
 Unregister a callback as a plugin hook of event handler. More...
 
 clearHandlers ($name, $type)
 Clears all callback registrations for a plugin hook. More...
 
 getAllHandlers ()
 Returns all registered handlers as array( $name => array( $type => array( $priority => array( callback, callback, ) ) ) More...
 
 hasHandler ($name, $type)
 Is a handler registered for this specific name and type? "all" handlers are not considered. More...
 
 getOrderedHandlers ($name, $type)
 Returns an ordered array of handlers registered for $name and $type. More...
 
 backup ()
 Temporarily remove all event/hook registrations (before tests) More...
 
 restore ()
 Restore backed up event/hook registrations (after tests) More...
 

Additional Inherited Members

- Public Attributes inherited from Elgg\HooksRegistrationService
const REG_KEY_PRIORITY = 0
 
const REG_KEY_INDEX = 1
 
const REG_KEY_HANDLER = 2
 
const OPTION_DEPRECATION_MESSAGE = 'deprecation_message'
 
const OPTION_DEPRECATION_VERSION = 'deprecation_version'
 
- Protected Member Functions inherited from Elgg\HooksRegistrationService
 getMatcher ($spec)
 Create a matcher for the given callable (if it's for a static or dynamic method) More...
 
 checkDeprecation ($name, $type, array $options=[])
 Check if handlers are registered on a deprecated hook/event. More...
 

Detailed Description

Plugin Hooks.

Use elgg()->hooks

Definition at line 11 of file PluginHooksService.php.

Constructor & Destructor Documentation

Elgg\PluginHooksService::__construct ( EventsService  $events)

Constructor.

Parameters
EventsService$eventsEvents

Definition at line 23 of file PluginHooksService.php.

Member Function Documentation

Elgg\PluginHooksService::getEvents ( )

Get the events API.

Returns
EventsService

Definition at line 33 of file PluginHooksService.php.

Elgg\PluginHooksService::registerHandler (   $name,
  $type,
  $callback,
  $priority = 500 
)

{}

Definition at line 129 of file PluginHooksService.php.

Elgg\PluginHooksService::trigger (   $name,
  $type,
  $params = null,
  $value = null,
array  $options = [] 
)

Triggers a plugin hook.

Parameters
string$nameThe name of the plugin hook
string$typeThe type of the plugin hook
mixed$paramsSupplied params for the hook
mixed$valueThe value of the hook, this can be altered by registered callbacks
array$options(internal) options for triggering the plugin hook
Returns
mixed
See also
elgg_trigger_plugin_hook()

Definition at line 52 of file PluginHooksService.php.

Elgg\PluginHooksService::triggerDeprecated (   $name,
  $type,
  $params = null,
  $value = null,
  $message = null,
  $version = null 
)

Trigger an plugin hook normally, but send a notice about deprecated use if any handlers are registered.

Parameters
string$nameThe name of the plugin hook
string$typeThe type of the plugin hook
mixed$paramsSupplied params for the hook
mixed$valueThe value of the hook, this can be altered by registered callbacks
string$messageThe deprecation message
string$versionHuman-readable release version: 1.9, 1.10, ...
Returns
mixed
See also
PluginHooksService::trigger()
elgg_trigger_deprecated_plugin_hook()

Definition at line 117 of file PluginHooksService.php.

Elgg\PluginHooksService::unregisterHandler (   $name,
  $type,
  $callback 
)

Definition at line 140 of file PluginHooksService.php.


The documentation for this class was generated from the following file: