Elgg  Version 5.1
submit.php
Go to the documentation of this file.
1 <?php
8 $item = elgg_extract('item', $vars);
9 if (!$item instanceof \ElggMenuItem) {
10  return;
11 }
12 
13 unset($vars['item']);
14 
15 $vars = array_merge($item->getValues(), $vars);
16 $vars['class'] = elgg_extract_class($vars, ['elgg-menu-content']);
17 
18 if ($item->getLinkClass()) {
19  $vars['class'] = array_merge($vars['class'], explode(' ', $item->getLinkClass()));
20 }
21 
23 if (!elgg_is_empty($href)) {
24  // the href of the menu item is used as the custom formaction for the button
25  $vars['formaction'] = $href;
26 }
27 
28 unset($vars['href']);
29 
30 if ($item->getConfirmText()) {
31  $vars['confirm'] = $item->getConfirmText();
32 }
33 
34 echo elgg_view('input/submit', $vars);
$vars['type']
Renders a <button type="submit">
Definition: submit.php:10
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:276
Elgg Menu Item.
elgg_is_empty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: input.php:176
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
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177