24 private $widgetCache = [];
41 $widget_cache_key =
"{$context}-{$owner_guid}";
43 if (isset($this->widgetCache[$widget_cache_key])) {
44 return $this->widgetCache[$widget_cache_key];
49 'subtype' =>
'widget',
51 'metadata_name' =>
'context',
57 $this->widgetCache[$widget_cache_key] = [];
63 $widget_column = (int)
$widget->column;
65 if (!isset($sorted_widgets[$widget_column])) {
66 $sorted_widgets[$widget_column] = [];
69 if (!isset($sorted_widgets[$widget_column][
$widget->order])) {
70 $sorted_widgets[$widget_column][
$widget->order] = [];
76 foreach ($sorted_widgets as $col => $orders) {
86 $sorted_widgets[$col] = $sorted_col;
89 $this->widgetCache[$widget_cache_key] = $sorted_widgets;
91 return $sorted_widgets;
179 $this->widgets[$definition->id] = $definition;
192 unset($this->widgets[
$id]);
207 $types = $this->getTypes([
211 $found = array_key_exists(
$id, $types);
213 if (!$found && (
$context ===
null)) {
215 $found = array_key_exists(
$id, $this->widgets);
242 $types = $this->getTypes([
246 if (isset($types[
$id])) {
247 return $types[
$id]->name;
273 $available_widgets =
_elgg_services()->events->triggerResults(
'handlers',
'widgets',
$params, $this->widgets);
274 if (!is_array($available_widgets)) {
280 foreach ($available_widgets as $widget_definition) {
281 if (!$widget_definition instanceof WidgetDefinition) {
285 if (!in_array(
$context, $widget_definition->context)) {
289 if (!$widget_definition->isValid()) {
293 $widgets[$widget_definition->id] = $widget_definition;
$id
Generic annotation delete action.
$params
Saves global plugin settings.
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'=>[],]
Exception indicating a user could not be looked up for a permissions check.
elgg_get_context()
Get the current context.
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_get_default_access(?\ElggUser $user=null, array $input_params=[])
Gets the default access permission.
get_entity(int $guid)
Loads and returns an entity object from a guid.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
if(empty($page_owner)|| $owner->guid !==$page_owner->guid) $widgets