[Solar-svn] Revision 3116
pmjones at solarphp.com
pmjones at solarphp.com
Sun Apr 13 13:38:27 CDT 2008
Solar_View_Helper_FormImage: [NEW] View helper for 'input type="image"'.
Added: trunk/Solar/View/Helper/FormImage.php
===================================================================
--- trunk/Solar/View/Helper/FormImage.php (rev 0)
+++ trunk/Solar/View/Helper/FormImage.php 2008-04-13 18:38:27 UTC (rev 3116)
@@ -0,0 +1,47 @@
+<?php
+/**
+ *
+ * Helper for a 'image' element.
+ *
+ * @category Solar
+ *
+ * @package Solar_View_Helper_Form
+ *
+ * @author Paul M. Jones <pmjones at solarphp.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id: FormImage.php 2933 2007-11-09 20:37:35Z moraes $
+ *
+ */
+class Solar_View_Helper_FormImage extends Solar_View_Helper_FormElement {
+
+ /**
+ *
+ * Generates an 'image' element.
+ *
+ * @param array $info An array of element information. Uses the element
+ * 'attribs[src]' for the image source.
+ *
+ * @return string The element XHTML.
+ *
+ */
+ public function formImage($info)
+ {
+ $this->_prepare($info);
+
+ // look for attribs['src']
+ if (! empty($this->_attribs['src'])) {
+ $src = $this->_attribs['src'];
+ unset($this->_attribs['src']);
+ }
+
+ $xhtml = '<input type="image"'
+ . ' name="' . $this->_view->escape($this->_name) . '"'
+ . ' src="' . $this->_view->publicHref($src) . '"'
+ . $this->_view->attribs($this->_attribs)
+ . '/>';
+
+ return $xhtml;
+ }
+}
More information about the Solar-svn
mailing list