Elgg  Version master
edit.php
Go to the documentation of this file.
1 <?php
9 
10 $widget = elgg_extract('entity', $vars);
11 if (!$widget instanceof \ElggWidget) {
12  return;
13 }
14 
15 if (!$widget->canEdit()) {
16  throw new EntityPermissionsException();
17 }
18 
19 $form = elgg_view_form('widgets/save', [
20  'class' => [
21  preg_replace('/[^a-z0-9-]/i', '-', "elgg-form-widgets-save-{$widget->handler}"),
22  ],
23  'prevent_double_submit' => false,
24 ], $vars);
25 
26 if (empty($form)) {
27  return;
28 }
29 
30 echo elgg_format_element('div', [
31  'class' => 'elgg-widget-edit',
32  'id' => "widget-edit-{$widget->guid}",
33 ], $form);
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
Definition: views.php:1033
if(!$widget instanceof\ElggWidget) if(!$widget->canEdit()) $form
Definition: edit.php:19
$widget
Definition: edit.php:10
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
Thrown when entity can not be edited or container permissions do not allow it to be written...
$vars
Definition: theme.php:5
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145