Elgg  Version 2.3
edit.php
Go to the documentation of this file.
1 <?php
6 $widget = elgg_extract('entity', $vars);
7 
8 // dashboard widget has type parameter
9 if (elgg_in_context('dashboard')) {
10  if (!isset($widget->content_type)) {
11  $widget->content_type = 'friends';
12  }
13 
15  '#type' => 'select',
16  'name' => 'params[content_type]',
17  '#label' => elgg_echo('river:widget:type'),
18  'value' => $widget->content_type,
19  'options_values' => [
20  'friends' => elgg_echo('river:widgets:friends'),
21  'all' => elgg_echo('river:widgets:all'),
22  ],
23  ]);
24 }
25 
26 echo elgg_view('object/widget/edit/num_display', [
27  'entity' => $widget,
28  'default' => 8,
29 ]);
30 
31 // pass the context so we have the correct output upon save.
32 $context = elgg_in_context('dashboard') ? 'dashboard' : 'profile';
33 
34 echo elgg_view('input/hidden', [
35  'name' => 'context',
36  'value' => $context,
37 ]);
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1424
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$vars['entity']
$widget
Friend widget options.
Definition: edit.php:6
elgg_in_context($context)
Check if this context exists anywhere in the stack.
Definition: pageowner.php:241
elgg echo
Translates a string.
Definition: languages.js:48
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
$context
Definition: edit.php:32