Elgg  Version master
Functions
actions.php File Reference

Go to the source code of this file.

Functions

 elgg_register_action (string $action, string $filename= '', string $access= 'logged_in', array $params=[])
 Elgg Actions. More...
 
 elgg_unregister_action (string $action)
 Unregisters an action. More...
 
 elgg_build_hmac ($data)
 Get an HMAC token builder/validator object. More...
 
 elgg_action_exists (string $action)
 Check if an action is registered and its script exists. More...
 
 elgg_is_xhr ()
 Checks whether the request was requested via ajax. More...
 

Function Documentation

elgg_action_exists ( string  $action)

Check if an action is registered and its script exists.

Parameters
string$actionAction name
Returns
bool
Since
1.8.0

Definition at line 68 of file actions.php.

elgg_build_hmac (   $data)

Get an HMAC token builder/validator object.

Parameters
mixed$dataHMAC data string or serializable data
Returns
Since
1.11

Definition at line 56 of file actions.php.

elgg_is_xhr ( )

Checks whether the request was requested via ajax.

Returns
bool whether page was requested via ajax
Since
1.8.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 78 of file actions.php.

elgg_register_action ( string  $action,
string  $filename = '',
string  $access = 'logged_in',
array  $params = [] 
)

Elgg Actions.

Registers an action.

Actions are registered to a script in the system and are executed by the URL http://elggsite.org/action/action_name/.

$filename must be the full path of the file to register or a path relative to the core actions/ dir.

Actions should be namespaced for your plugin. Example: elgg_register_action('myplugin/save_settings', ...);

Put action files under the actions/<plugin_name> directory of your plugin.

You don't need to use Elgg in your action files.

Parameters
string$actionThe name of the action (eg "register", "account/settings/save")
string$filenameOptionally, 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, admin. (default: logged_in)
array$paramsAdditional params for the action route registration:
  • middleware: additional middleware on the action route
Returns
void

Definition at line 34 of file actions.php.

elgg_unregister_action ( string  $action)

Unregisters an action.

Parameters
string$actionAction name
Returns
void
Since
1.8.1

Definition at line 45 of file actions.php.