00001 <?php
00027 require_once 'Zend/View/Helper/FormElement.php';
00028
00029
00039 class Zend_View_Helper_FormButton extends Zend_View_Helper_FormElement
00040 {
00056 public function formButton($name, $value = null, $attribs = null)
00057 {
00058 $info = $this->_getInfo($name, $value, $attribs);
00059 extract($info);
00060
00061
00062 $content = '';
00063 if (isset($attribs['content'])) {
00064 $content = $attribs['content'];
00065 unset($attribs['content']);
00066 } else {
00067 $content = $value;
00068 }
00069
00070
00071 $type = 'button';
00072 if (isset($attribs['type'])) {
00073 $attribs['type'] = strtolower($attribs['type']);
00074 if (in_array($attribs['type'], array('submit', 'reset', 'button'))) {
00075 $type = $attribs['type'];
00076 }
00077 unset($attribs['type']);
00078 }
00079
00080
00081 if ($disable) {
00082 $attribs['disabled'] = 'disabled';
00083 }
00084
00085 $content = ($escape) ? $this->view->escape($content) : $content;
00086
00087 $xhtml = '<button'
00088 . ' name="' . $this->view->escape($name) . '"'
00089 . ' id="' . $this->view->escape($id) . '"'
00090 . ' type="' . $type . '"';
00091
00092
00093 if (!empty($value)) {
00094 $xhtml .= ' value="' . $this->view->escape($value) . '"';
00095 }
00096
00097
00098 $xhtml .= $this->_htmlAttribs($attribs) . '>';
00099
00100
00101 $xhtml .= $content . '</button>';
00102
00103 return $xhtml;
00104 }
00105 }