Elgg  Version 3.0
Public Member Functions | List of all members
Elgg\WidgetsService Class Reference

WARNING: API IN FLUX. More...

Public Member Functions

 getWidgets ($owner_guid, $context)
 Get widgets for a particular context. More...
 
 createWidget ($owner_guid, $handler, $context, $access_id=null)
 Create a new widget instance. More...
 
 canEditLayout ($context, $user_guid=0)
 Can the user edit the widget layout. More...
 
 registerType (WidgetDefinition $definition)
 Register a widget type. More...
 
 unregisterType ($id)
 Remove a widget type. More...
 
 validateType ($id, $context=null,\ElggEntity $container=null)
 Checks if a widget type exists for a given id. More...
 
 getAllTypes ()
 Get all widgets. More...
 
 getNameById ($id, $context= '',\ElggEntity $container=null)
 Returns widget name based on id. More...
 
 getTypes (array $params=[])
 

Detailed Description

WARNING: API IN FLUX.

DO NOT USE DIRECTLY.

Use the elgg_* versions instead.

Definition at line 18 of file WidgetsService.php.

Member Function Documentation

Elgg\WidgetsService::canEditLayout (   $context,
  $user_guid = 0 
)

Can the user edit the widget layout.

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

Definition at line 151 of file WidgetsService.php.

Elgg\WidgetsService::createWidget (   $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
See also
elgg_create_widget()

Definition at line 112 of file WidgetsService.php.

Elgg\WidgetsService::getAllTypes ( )

Get all widgets.

Returns
[]

Definition at line 244 of file WidgetsService.php.

Elgg\WidgetsService::getNameById (   $id,
  $context = '',
\ElggEntity  $container = null 
)

Returns widget name based on id.

Parameters
string$idWidget identifier
string$contextContext to check
\ElggEntity$containerOptional limit widget definitions to a container
Returns
string|boolean
Since
2.2.0

Definition at line 259 of file WidgetsService.php.

Elgg\WidgetsService::getTypes ( array  $params = [])
Parameters
array$paramsAssociative array of params used to determine what to return

array ( 'context' => string (defaults to elgg_get_context()), 'container' => (defaults to null) )

Returns
[]

Definition at line 280 of file WidgetsService.php.

Elgg\WidgetsService::getWidgets (   $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
[] An 2D array of objects
See also
elgg_get_widgets()

Definition at line 45 of file WidgetsService.php.

Elgg\WidgetsService::registerType ( WidgetDefinition  $definition)

Register a widget type.

Parameters
WidgetDefinition$definitionDefinition of the widget
Returns
bool
See also
elgg_register_widget_type()

Definition at line 184 of file WidgetsService.php.

Elgg\WidgetsService::unregisterType (   $id)

Remove a widget type.

Parameters
string$idThe identifier for the widget
Returns
bool
See also
elgg_unregister_widget_type()

Definition at line 204 of file WidgetsService.php.

Elgg\WidgetsService::validateType (   $id,
  $context = null,
\ElggEntity  $container = null 
)

Checks if a widget type exists for a given id.

Parameters
string$idWidget identifier
string$contextOptional context to check
\ElggEntity$containerOptional limit widget definitions to a container
Returns
bool
See also
elgg_is_widget_type()

Definition at line 224 of file WidgetsService.php.


The documentation for this class was generated from the following file: