Elgg  Version master
widgets.php
Go to the documentation of this file.
1 <?php
20 function elgg_get_widgets(int $owner_guid, string $context): array {
21  return _elgg_services()->widgets->getWidgets($owner_guid, $context);
22 }
23 
35 function elgg_create_widget(int $owner_guid, string $handler, string $context, int $access_id = null) {
36  return _elgg_services()->widgets->createWidget($owner_guid, $handler, $context, $access_id);
37 }
38 
50 function elgg_can_edit_widget_layout(string $context, int $user_guid = 0): bool {
51  return _elgg_services()->widgets->canEditLayout($context, $user_guid);
52 }
53 
65  $definition = \Elgg\WidgetDefinition::factory($options);
66 
67  _elgg_services()->widgets->registerType($definition);
68 }
69 
79  _elgg_services()->widgets->unregisterType($handler);
80 }
81 
92 function elgg_is_widget_type(string $handler, string $context = null, \ElggEntity $container = null): bool {
93  return _elgg_services()->widgets->validateType($handler, $context, $container);
94 }
95 
112 function elgg_get_widget_types(string|array $context = ''): array {
113  if (is_array($context)) {
114  $params = $context;
115  } else {
116  $params = [
117  'context' => $context,
118  'container' => null,
119  ];
120  }
121 
122  return _elgg_services()->widgets->getTypes($params);
123 }
$user_guid
Definition: login_as.php:10
elgg_is_widget_type(string $handler, string $context=null,\ElggEntity $container=null)
Has a widget type with the specified handler been registered.
Definition: widgets.php:92
$params
Saves global plugin settings.
Definition: save.php:13
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
elgg_can_edit_widget_layout(string $context, int $user_guid=0)
Can the user edit the widget layout.
Definition: widgets.php:50
if(!$owner instanceof\ElggEntity) $context
Definition: widgets.php:28
$options
Elgg admin footer.
Definition: footer.php:6
elgg_create_widget(int $owner_guid, string $handler, string $context, int $access_id=null)
Create a new widget instance.
Definition: widgets.php:35
elgg_get_widget_types(string|array $context= '')
Get the widget types for a context.
Definition: widgets.php:112
static factory(array $options)
Create an WidgetDefinition from an associative array.
elgg_register_widget_type(array $options)
Register a widget type.
Definition: widgets.php:64
$container
Definition: delete.php:24
elgg_unregister_widget_type(string $handler)
Remove a widget type.
Definition: widgets.php:78
elgg_get_widgets(int $owner_guid, string $context)
Elgg widgets library.
Definition: widgets.php:20
$owner_guid
Definition: widgets.php:15
$access_id
Definition: access.php:10
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
$handler
Definition: add.php:7