Elgg  Version 6.1
Public Member Functions | Protected Attributes | 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...
 

Protected Attributes

const ACCESS_LEVELS = ['public', 'logged_in', 'logged_out', 'admin']
 
const UNPROTECTED_ACTIONS = ['logout']
 Actions for which CSRF firewall should be bypassed. More...
 

Detailed Description

Actions service.

Definition at line 20 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 35 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 125 of file ActionsService.php.

Elgg\ActionsService::getAllActions ( )

Get all actions.

Returns
array

Definition at line 155 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 52 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 110 of file ActionsService.php.

Member Data Documentation

const Elgg\ActionsService::ACCESS_LEVELS = ['public', 'logged_in', 'logged_out', 'admin']
protected

Definition at line 22 of file ActionsService.php.

const Elgg\ActionsService::UNPROTECTED_ACTIONS = ['logout']
protected

Actions for which CSRF firewall should be bypassed.

Definition at line 27 of file ActionsService.php.


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