Elgg  Version 4.3
Functions
widgets.php File Reference

Go to the source code of this file.

Functions

 elgg_get_widgets ($owner_guid, $context)
 Elgg widgets library. More...
 
 elgg_create_widget ($owner_guid, $handler, $context, $access_id=null)
 Create a new widget instance. More...
 
 elgg_can_edit_widget_layout ($context, $user_guid=0)
 Can the user edit the widget layout. More...
 
 elgg_register_widget_type ($handler, $name=null, $description=null, $context=[], $multiple=false)
 Register a widget type. More...
 
 elgg_unregister_widget_type ($handler)
 Remove a widget type. More...
 
 elgg_is_widget_type ($handler, $context=null,\ElggEntity $container=null)
 Has a widget type with the specified handler been registered. More...
 
 elgg_get_widget_types ($context="")
 Get the widget types for a context. More...
 

Function Documentation

elgg_can_edit_widget_layout (   $context,
  $user_guid = 0 
)

Can the user edit the widget layout.

Triggers a 'permissions_check', 'widget_layout' plugin hook

Parameters
string$contextThe widget context
int$user_guidThe GUID of the user (0 for logged in user)
Returns
bool
Since
1.8.0

Definition at line 50 of file widgets.php.

elgg_create_widget (   $owner_guid,
  $handler,
  $context,
  $access_id = null 
)

Create a new widget instance.

Parameters
int$owner_guidGUID of entity that owns this widget
string$handlerThe handler for this widget
string$contextThe context for this widget
int$access_idIf not specified, it is set to the default access level
Returns
int|false Widget GUID or false on failure
Since
1.8.0

Definition at line 35 of file widgets.php.

elgg_get_widget_types (   $context = "")

Get the widget types for a context.

If passing $context as an associative array you the following can be used: array ( 'context' => string (defaults to ''), 'exact' => bool (defaults to false), 'container' => (defaults to null) ) The contents of the array will be passed to the handlers:widgets hook.

Parameters
array | string$contextAn associative array of options or the widget context
Returns
[]
Since
1.8.0

Definition at line 127 of file widgets.php.

elgg_get_widgets (   $owner_guid,
  $context 
)

Elgg widgets library.

Contains code for handling widgets. Get widgets for a particular context

The widgets are ordered for display and grouped in columns. $widgets = elgg_get_widgets(elgg_get_logged_in_user_guid(), 'dashboard'); $first_column_widgets = $widgets[1];

Parameters
int$owner_guidThe owner GUID of the layout
string$contextThe context (profile, dashboard, etc)
Returns
array An 2D array of objects
Since
1.8.0

Definition at line 20 of file widgets.php.

elgg_is_widget_type (   $handler,
  $context = null,
\ElggEntity  $container = null 
)

Has a widget type with the specified handler been registered.

Parameters
string$handlerThe widget handler identifying string
string$contextOptional context to check
\ElggEntity$containerOptional limit widget definitions to a container
Returns
bool Whether or not that widget type exists
Since
1.8.0

Definition at line 107 of file widgets.php.

elgg_register_widget_type (   $handler,
  $name = null,
  $description = null,
  $context = [],
  $multiple = false 
)

Register a widget type.

This should be called by plugins in their init function.

Parameters
string | array$handlerAn array of options or the identifier for the widget handler
string$nameThe name of the widget type
string$descriptionA description for the widget type
array$contextAn array of contexts where this widget is allowed
bool$multipleWhether or not multiple instances of this widget are allowed in a single layout (default: false)
Returns
bool
Since
1.8.0

Definition at line 69 of file widgets.php.

elgg_unregister_widget_type (   $handler)

Remove a widget type.

Parameters
string$handlerThe identifier for the widget
Returns
bool true if handler was found as unregistered
Since
1.8.0

Definition at line 93 of file widgets.php.