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
10 namespace Zend\Form\View\Helper
;
12 use Zend\Form\ElementInterface
;
13 use Zend\Form\Exception
;
15 class FormTextarea
extends AbstractHelper
18 * Attributes valid for the input tag
22 protected $validTagAttributes = array(
30 'placeholder' => true,
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)
51 return $this->render($element);
55 * Render a form <textarea> element from the provided $element
57 * @param ElementInterface $element
58 * @throws Exception\DomainException
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',
71 $attributes = $element->getAttributes();
72 $attributes['name'] = $name;
73 $content = (string) $element->getValue();
74 $escapeHtml = $this->getEscapeHtmlHelper();
77 '<textarea %s>%s</textarea>',
78 $this->createAttributesString($attributes),