29 private $widgetCache = [];
46 $widget_cache_key =
"$context-$owner_guid";
48 if (isset($this->widgetCache[$widget_cache_key])) {
49 return $this->widgetCache[$widget_cache_key];
54 'subtype' =>
'widget',
56 'private_setting_name' =>
'context',
59 'preload_private_settings' =>
true,
63 $this->widgetCache[$widget_cache_key] = [];
69 $widget_column = (int) $widget->column;
71 if (!isset($sorted_widgets[$widget_column])) {
72 $sorted_widgets[$widget_column] = [];
75 if (!isset($sorted_widgets[$widget_column][$widget->order])) {
76 $sorted_widgets[$widget_column][$widget->order] = [];
79 $sorted_widgets[$widget_column][$widget->order][] =
$widget;
82 foreach ($sorted_widgets as $col => $orders) {
87 foreach ($widgets as $widget) {
92 $sorted_widgets[$col] = $sorted_col;
95 $this->widgetCache[$widget_cache_key] = $sorted_widgets;
97 return $sorted_widgets;
185 $id = $definition->id;
190 $this->widgets[
$id] = $definition;
205 if (!isset($this->widgets[
$id])) {
209 unset($this->widgets[$id]);
225 $types = $this->getTypes([
229 $found = array_key_exists(
$id, $types);
231 if (!$found && (
$context === null)) {
233 $found = array_key_exists(
$id, $this->widgets);
260 $types = $this->getTypes([
264 if (isset($types[
$id])) {
265 return $types[
$id]->name;
287 $available_widgets =
_elgg_services()->hooks->trigger(
'handlers',
'widgets',
$params, $this->widgets);
288 if (!is_array($available_widgets)) {
294 foreach ($available_widgets as $widget_definition) {
299 if (!in_array(
$context, $widget_definition->context)) {
303 if (!$widget_definition->isValid()) {
307 $widgets[$widget_definition->id] = $widget_definition;
$params
Saves global plugin settings.
if(!$enabled) if(PHP_SAPI!== 'cli')
Interates through each element of an array and calls callback a function.
$user_guid
Validate a user.
$id
River item delete action.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Exception indicating a user could not be looked up for a permissions check.
elgg_get_context()
Get the current context.
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif(is_callable([$item, 'getType']))
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
_elgg_services()
Get the global service provider.
get_default_access(ElggUser $user=null, array $input_params=[])
Gets the default access permission.
get_entity($guid)
Loads and returns an entity object from a guid.