Elgg  Version 5.1
Public Member Functions | Protected Attributes | List of all members
Elgg\ActionsService Class Reference

Actions service. More...

Public Member Functions

 __construct (RouteRegistrationService $routes, HandlersService $handlers)
 Constructor. More...
 
 register (string $action, string $handler= '', string $access= 'logged_in', array $params=[])
 Registers an action. More...
 
 unregister (string $action)
 Unregisters an action. More...
 
 exists (string $action)
 Check if an action is registered and its script exists. More...
 
 getAllActions ()
 Get all actions. More...
 

Protected Attributes

 $routes
 
 $handlers
 

Detailed Description

Actions service.

Definition at line 21 of file ActionsService.php.

Constructor & Destructor Documentation

Elgg\ActionsService::__construct ( RouteRegistrationService  $routes,
HandlersService  $handlers 
)

Constructor.

Parameters
RouteRegistrationService$routesRoutes
HandlersService$handlersHandlers service

Definition at line 54 of file ActionsService.php.

Member Function Documentation

Elgg\ActionsService::exists ( string  $action)

Check if an action is registered and its script exists.

Parameters
string$actionAction name
Returns
bool
See also
elgg_action_exists()

Definition at line 153 of file ActionsService.php.

Elgg\ActionsService::getAllActions ( )

Get all actions.

Returns
array

Definition at line 183 of file ActionsService.php.

Elgg\ActionsService::register ( string  $action,
string  $handler = '',
string  $access = 'logged_in',
array  $params = [] 
)

Registers an action.

Parameters
string$actionThe name of the action (eg "register", "account/settings/save")
string$handlerOptionally, the filename where this action is located. If not specified, will assume the action is in elgg/actions/<action>.php
string$accessWho is allowed to execute this action: public, logged_in, logged_out, admin. (default: logged_in)
array$paramsAdditional params for the action route registration:
  • middleware: additional middleware on the action route
Returns
void
Exceptions

Definition at line 73 of file ActionsService.php.

Elgg\ActionsService::unregister ( string  $action)

Unregisters an action.

Parameters
string$actionAction name
Returns
void
See also
elgg_unregister_action()

Definition at line 133 of file ActionsService.php.

Member Data Documentation

Elgg\ActionsService::$handlers
protected

Definition at line 46 of file ActionsService.php.

Elgg\ActionsService::$routes
protected

Definition at line 41 of file ActionsService.php.


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