|
Elgg
Version master
|
Public Member Functions | |
| getWidgets (int $owner_guid, string $context) | |
| Get widgets for a particular context. More... | |
| createWidget (int $owner_guid, string $handler, string $context, ?int $access_id=null) | |
| Create a new widget instance. More... | |
| canEditLayout (string $context, int $user_guid=0) | |
| Can the user edit the widget layout. More... | |
| registerType (WidgetDefinition $definition) | |
| Register a widget type. More... | |
| unregisterType (string $id) | |
| Remove a widget type. More... | |
| validateType (string $id, ?string $context=null, ?\ElggEntity $container=null) | |
| Checks if a widget type exists for a given id. More... | |
| getAllTypes () | |
| Get all widgets. More... | |
| getNameById (string $id, string $context='', ?\ElggEntity $container=null) | |
| Returns widget name based on id. More... | |
| getTypes (array $params=[]) | |
| Returns the registered widget types. More... | |
Widgets service.
Definition at line 13 of file WidgetsService.php.
| Elgg\WidgetsService::canEditLayout | ( | string | $context, |
| int | $user_guid = 0 |
||
| ) |
Can the user edit the widget layout.
| string | $context | The widget context |
| int | $user_guid | The GUID of the user (0 for logged-in user) |
Definition at line 145 of file WidgetsService.php.
| Elgg\WidgetsService::createWidget | ( | int | $owner_guid, |
| string | $handler, | ||
| string | $context, | ||
| ?int | $access_id = null |
||
| ) |
Create a new widget instance.
| int | $owner_guid | GUID of entity that owns this widget |
| string | $handler | The handler for this widget |
| string | $context | The context for this widget |
| null | int | $access_id | If not specified, it is set to the default access level |
Definition at line 106 of file WidgetsService.php.
| Elgg\WidgetsService::getAllTypes | ( | ) |
| Elgg\WidgetsService::getNameById | ( | string | $id, |
| string | $context = '', |
||
| ?\ElggEntity | $container = null |
||
| ) |
Returns widget name based on id.
| string | $id | Widget identifier |
| string | $context | Context to check |
| null | \ElggEntity | $container | Optional limit widget definitions to a container |
Definition at line 241 of file WidgetsService.php.
| Elgg\WidgetsService::getTypes | ( | array | $params = [] | ) |
Returns the registered widget types.
Use params to limit the result: [ 'context' => string (defaults to elgg_get_context()), 'container' => \ElggEntity (defaults to null) ]
| array | $params | Associative array of params used to determine what to return |
Definition at line 266 of file WidgetsService.php.
| Elgg\WidgetsService::getWidgets | ( | int | $owner_guid, |
| string | $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];
| int | $owner_guid | The owner GUID of the layout |
| string | $context | The context (profile, dashboard, etc) |
Definition at line 40 of file WidgetsService.php.
| Elgg\WidgetsService::registerType | ( | WidgetDefinition | $definition | ) |
Register a widget type.
| WidgetDefinition | $definition | Definition of the widget |
Definition at line 178 of file WidgetsService.php.
| Elgg\WidgetsService::unregisterType | ( | string | $id | ) |
Remove a widget type.
| string | $id | The identifier for the widget |
Definition at line 191 of file WidgetsService.php.
| Elgg\WidgetsService::validateType | ( | string | $id, |
| ?string | $context = null, |
||
| ?\ElggEntity | $container = null |
||
| ) |
Checks if a widget type exists for a given id.
| string | $id | Widget identifier |
| null | string | $context | Optional context to check |
| null | \ElggEntity | $container | Optional limit widget definitions to a container |
Definition at line 206 of file WidgetsService.php.