PluginProbe
Contact Forms by Cimatti / 1.9.2
Contact Forms by Cimatti v1.9.2
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / PFBC / Element / Button.php

Button.php in Contact Forms by Cimatti 1.9.2, at PFBC/Element/Button.php

39 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class Element_Button extends Element {
3 protected $attributes = array("type" => "submit", "value" => "Submit");
4 protected $icon;
5
6 public function __construct($label = "Submit", $type = "", array $properties = null) {
7 if(!is_array($properties))
8 $properties = array();
9
10 if(!empty($type))
11 $properties["type"] = $type;
12
13 if(empty($properties["value"]))
14 $properties["value"] = $label;
15
16 parent::__construct($label, "", $properties);
17 }
18
19 public function jQueryDocumentReady() {
20 /*Unless explicitly prevented, jQueryUI's button widget functionality is applied to
21 the each Button element.*/
22 if(!in_array("jQueryUIButtons", $this->form->getPrevent())) {
23 echo 'jQuery("#', $this->attributes["id"], '").button(';
24 /*Any of the jQueryUI framework icons can be added to your buttons via the icon
25 property. See http://jqueryui.com/themeroller/ for a complete list of available
26 icons.*/
27 if(!empty($this->icon))
28 echo '{ icons: { primary: "ui-icon-', $this->icon, '" } }';
29 echo ');';
30 }
31 }
32
33 public function render() {
34 /*The button tag is used instead of input b/c it functions better with jQueryUI's
35 button widget - specifically the icon option.*/
36 echo '<button', $this->getAttributes(), '>', $this->label, '</button>';
37 }
38 }
39