Elgg  Version master
context.php
Go to the documentation of this file.
1 <?php
29 function elgg_set_context(string $context): bool {
30  return _elgg_services()->request->getContextStack()->set($context);
31 }
32 
41 function elgg_get_context(): ?string {
42  return _elgg_services()->request->getContextStack()->peek();
43 }
44 
52 function elgg_push_context(string $context): void {
53  _elgg_services()->request->getContextStack()->push($context);
54 }
55 
62 function elgg_pop_context(): ?string {
63  return _elgg_services()->request->getContextStack()->pop();
64 }
65 
78 function elgg_in_context(string $context): bool {
79  return _elgg_services()->request->getContextStack()->contains($context);
80 }
81 
88 function elgg_get_context_stack(): array {
89  return _elgg_services()->request->getContextStack()->toArray();
90 }
91 
99 function elgg_set_context_stack(array $stack): void {
100  _elgg_services()->request->getContextStack()->fromArray($stack);
101 }
$context
Definition: add.php:8
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:73
elgg_get_context()
Get the current context.
Definition: context.php:41
elgg_get_context_stack()
Get the entire context stack (e.g.
Definition: context.php:88
elgg_push_context(string $context)
Push a context onto the top of the stack.
Definition: context.php:52
elgg_set_context(string $context)
Elgg context library.
Definition: context.php:29
elgg_set_context_stack(array $stack)
Set the entire context stack.
Definition: context.php:99
elgg_in_context(string $context)
Check if this context exists anywhere in the stack.
Definition: context.php:78
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: context.php:62
_elgg_services()
Get the global service provider.
Definition: elgglib.php:353