Elgg  Version 4.3
widgets.php
Go to the documentation of this file.
1 <?php
21  return _elgg_services()->widgets->getWidgets($owner_guid, $context);
22 }
23 
36  return _elgg_services()->widgets->createWidget($owner_guid, $handler, $context, $access_id);
37 }
38 
51  return _elgg_services()->widgets->canEditLayout($context, $user_guid);
52 }
53 
69 function elgg_register_widget_type($handler, $name = null, $description = null, $context = [], $multiple = false) {
70  if (is_array($handler)) {
72  } else {
73  $definition = \Elgg\WidgetDefinition::factory([
74  'id' => $handler,
75  'name' => $name,
76  'description' => $description,
77  'context' => $context,
78  'multiple' => $multiple,
79  ]);
80  }
81 
82  return _elgg_services()->widgets->registerType($definition);
83 }
84 
94  return _elgg_services()->widgets->unregisterType($handler);
95 }
96 
108  return _elgg_services()->widgets->validateType($handler, $context, $container);
109 }
110 
128  if (is_array($context)) {
129  $params = $context;
130  } else {
131  $params = [
132  'context' => $context,
133  'container' => null,
134  ];
135  }
136  return _elgg_services()->widgets->getTypes($params);
137 }
$user_guid
Definition: login_as.php:10
$params
Saves global plugin settings.
Definition: save.php:13
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
elgg_is_widget_type($handler, $context=null,\ElggEntity $container=null)
Has a widget type with the specified handler been registered.
Definition: widgets.php:107
elgg_register_widget_type($handler, $name=null, $description=null, $context=[], $multiple=false)
Register a widget type.
Definition: widgets.php:69
elgg_get_widget_types($context="")
Get the widget types for a context.
Definition: widgets.php:127
elgg_get_widgets($owner_guid, $context)
Elgg widgets library.
Definition: widgets.php:20
static factory(array $options)
Create an WidgetDefinition from an associative array.
elgg_can_edit_widget_layout($context, $user_guid=0)
Can the user edit the widget layout.
Definition: widgets.php:50
$container
Definition: delete.php:23
$description
Definition: record.php:15
if($owner->guid!=$page_owner->guid) $context
Definition: widgets.php:35
$owner_guid
Definition: widgets.php:15
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638
$access_id
Definition: access.php:11
$handler
Definition: add.php:7
elgg_unregister_widget_type($handler)
Remove a widget type.
Definition: widgets.php:93
elgg_create_widget($owner_guid, $handler, $context, $access_id=null)
Create a new widget instance.
Definition: widgets.php:35