Elgg  Version master
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);
Elgg Menu Item.
elgg_extract_class(array $array, array|string $existing=[], string $extract_key='class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:279
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:256
elgg_is_empty($value)
Check if a value isn't empty, but allow 0 and '0'.
Definition: input.php:176
$vars['type']
Renders a <button type="submit">
Definition: submit.php:10
elgg_view(string $view, array $vars=[], string $viewtype='')
Return a parsed view.
Definition: views.php:156
if($item->getLinkClass()) $href
Definition: submit.php:22
$item
Output an ElggMenuItem as a submit button.
Definition: submit.php:8