Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
button.php
Go to the documentation of this file.
1 <?php
12 $vars['class'] = (array) elgg_extract('class', $vars, []);
13 $vars['class'][] = "elgg-button";
14 
15 $defaults = ['type' => 'button'];
16 
17 $vars = array_merge($defaults, $vars);
18 
19 switch ($vars['type']) {
20  case 'button':
21  case 'reset':
22  case 'submit':
23  case 'image':
24  break;
25  default:
26  $vars['type'] = 'button';
27  break;
28 }
29 
30 // blank src if trying to access an offsite image. @todo why?
31 if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) {
32  $vars['src'] = "";
33 }
34 
35 echo elgg_format_element('input', $vars);
$vars['class']
Definition: button.php:12
$defaults
Definition: button.php:15
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:218
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
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:1310