Elgg  Version 2.3
widget.php
Go to the documentation of this file.
1 <?php
10 $widget = elgg_extract('entity', $vars);
11 if (!($widget instanceof \ElggWidget)) {
12  return;
13 }
14 
15 $handler = $widget->handler;
16 
17 $widget_instance = preg_replace('/[^a-z0-9-]/i', '-', "elgg-widget-instance-$handler");
18 
20 $widget_class[] = $widget->canEdit() ? 'elgg-state-draggable' : 'elgg-state-fixed';
21 
22 echo elgg_view_module('widget', '', elgg_view('object/widget/body', $vars), [
23  'class' => $widget_class,
24  'id' => "elgg-widget-$widget->guid",
25  'header' => elgg_view('object/widget/header', $vars),
26 ]);
elgg_extract_class(array $array, $existing=[])
Extract class names from an array with key "class", optionally merging into a preexisting set...
Definition: elgglib.php:1396
$vars['entity']
$widget
Widget object.
Definition: widget.php:10
elgg echo
Translates a string.
Definition: languages.js:48
if(!($widget instanceof\ElggWidget)) $handler
Definition: widget.php:15
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1375
elgg_view_module($type, $title, $body, array $vars=array())
Wrapper function for the module display pattern.
Definition: views.php:1250
$widget_instance
Definition: widget.php:17
$widget_class
Definition: widget.php:19