Elgg  Version 1.9
Namespaces | Functions
widgets.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 elgg_get_widgets ($owner_guid, $context)
 Get widgets for a particular context. 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, $description, $context=array('all'), $multiple=false)
 Register a widget type. More...
 
 elgg_unregister_widget_type ($handler)
 Remove a widget type. More...
 
 elgg_is_widget_type ($handler)
 Has a widget type with the specified handler been registered. More...
 
 elgg_get_widget_types ($context="", $exact=false)
 Get the widget types for a context. More...
 
 _elgg_widgets_set_ajax_title ($hook, $type, $results, $params)
 Set the widget title on ajax return from save action. More...
 
 _elgg_widgets_init ()
 Function to initialize widgets functionality. More...
 
 _elgg_default_widgets_init ()
 Gets a list of events to create default widgets for and register menu items for default widgets with the admin section. More...
 
 _elgg_create_default_widgets ($event, $type, $entity)
 Creates default widgets. More...
 
 _elgg_default_widgets_permissions_override ($hook, $type, $return, $params)
 Overrides permissions checks when creating widgets for logged out users. More...
 

Function Documentation

◆ _elgg_create_default_widgets()

_elgg_create_default_widgets (   $event,
  $type,
  $entity 
)

Creates default widgets.

This plugin hook handler is registered for events based on what kinds of default widgets have been registered. See elgg_default_widgets_init() for information on registering new default widget contexts.

Parameters
string$eventThe event
string$typeThe type of object
ElggEntity$entityThe entity being created
Returns
void @access private

Definition at line 221 of file widgets.php.

◆ _elgg_default_widgets_init()

_elgg_default_widgets_init ( )

Gets a list of events to create default widgets for and register menu items for default widgets with the admin section.

A plugin that wants to register a new context for default widgets should register for the plugin hook 'get_list', 'default_widgets'. The handler can register the new type of default widgets by adding an associate array to the return value array like this: array( 'name' => elgg_echo('profile'), 'widget_context' => 'profile', 'widget_columns' => 3,

'event' => 'create', 'entity_type' => 'user', 'entity_subtype' => ELGG_ENTITIES_ANY_VALUE, );

The first set of keys define information about the new type of default widgets and the second set determine what event triggers the creation of the new widgets.

Returns
void @access private

Definition at line 185 of file widgets.php.

◆ _elgg_default_widgets_permissions_override()

_elgg_default_widgets_permissions_override (   $hook,
  $type,
  $return,
  $params 
)

Overrides permissions checks when creating widgets for logged out users.

Parameters
string$hookThe permissions hook.
string$typeThe type of entity being created.
string$returnValue
mixed$paramsParams
Returns
true|null @access private

Definition at line 288 of file widgets.php.

◆ _elgg_widgets_init()

_elgg_widgets_init ( )

Function to initialize widgets functionality.

Returns
void @access private

Definition at line 150 of file widgets.php.

◆ _elgg_widgets_set_ajax_title()

_elgg_widgets_set_ajax_title (   $hook,
  $type,
  $results,
  $params 
)

Set the widget title on ajax return from save action.

Parameters
string$hookHook name
string$typeHook type
array$resultsArray to be encoded as json
array$paramsParameters about the request
Returns
array|null @access private

Definition at line 133 of file widgets.php.

◆ elgg_can_edit_widget_layout()

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 53 of file widgets.php.

◆ elgg_create_widget()

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 38 of file widgets.php.

◆ elgg_get_widget_types()

elgg_get_widget_types (   $context = "",
  $exact = false 
)

Get the widget types for a context.

The widget types are stdClass objects.

Parameters
string$contextThe widget context or empty string for current context
bool$exactOnly return widgets registered for this context (false)
Returns
array
Since
1.8.0

Definition at line 119 of file widgets.php.

◆ elgg_get_widgets()

elgg_get_widgets (   $owner_guid,
  $context 
)

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 ElggWidget objects
Since
1.8.0

Definition at line 23 of file widgets.php.

◆ elgg_is_widget_type()

elgg_is_widget_type (   $handler)

Has a widget type with the specified handler been registered.

Parameters
string$handlerThe widget handler identifying string
Returns
bool Whether or not that widget type exists
Since
1.8.0

Definition at line 104 of file widgets.php.

◆ elgg_register_widget_type()

elgg_register_widget_type (   $handler,
  $name,
  $description,
  $context = array('all'),
  $multiple = false 
)

Register a widget type.

This should be called by plugins in their init function.

Parameters
string$handlerThe 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 (default: array('all'))
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 73 of file widgets.php.

◆ elgg_unregister_widget_type()

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 92 of file widgets.php.