Elgg  Version master
Public Member Functions | List of all members
Elgg\ActionsService Class Reference

Actions service. More...

Public Member Functions

 __construct (protected RouteRegistrationService $routes, protected 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...
 

Detailed Description

Actions service.

Definition at line 21 of file ActionsService.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
RouteRegistrationService$routesRoutes
HandlersService$handlersHandlers service

Definition at line 44 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 141 of file ActionsService.php.

Elgg\ActionsService::getAllActions ( )

Get all actions.

Returns
array

Definition at line 171 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 61 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 121 of file ActionsService.php.


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