Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Form / View / Helper / FormTextarea.php
blobe5bf832ee7abedd734fa5f3a2d3c948b8906b860
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Form\View\Helper;
12 use Zend\Form\ElementInterface;
13 use Zend\Form\Exception;
15 class FormTextarea extends AbstractHelper
17 /**
18 * Attributes valid for the input tag
20 * @var array
22 protected $validTagAttributes = array(
23 'autofocus' => true,
24 'cols' => true,
25 'dirname' => true,
26 'disabled' => true,
27 'form' => true,
28 'maxlength' => true,
29 'name' => true,
30 'placeholder' => true,
31 'readonly' => true,
32 'required' => true,
33 'rows' => true,
34 'wrap' => true,
37 /**
38 * Invoke helper as functor
40 * Proxies to {@link render()}.
42 * @param ElementInterface|null $element
43 * @return string|FormTextarea
45 public function __invoke(ElementInterface $element = null)
47 if (!$element) {
48 return $this;
51 return $this->render($element);
54 /**
55 * Render a form <textarea> element from the provided $element
57 * @param ElementInterface $element
58 * @throws Exception\DomainException
59 * @return string
61 public function render(ElementInterface $element)
63 $name = $element->getName();
64 if (empty($name) && $name !== 0) {
65 throw new Exception\DomainException(sprintf(
66 '%s requires that the element has an assigned name; none discovered',
67 __METHOD__
68 ));
71 $attributes = $element->getAttributes();
72 $attributes['name'] = $name;
73 $content = (string) $element->getValue();
74 $escapeHtml = $this->getEscapeHtmlHelper();
76 return sprintf(
77 '<textarea %s>%s</textarea>',
78 $this->createAttributesString($attributes),
79 $escapeHtml($content)