Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Textarea.php
Go to the documentation of this file.
1 <?php
13 
15 
17 {
21  const DEFAULT_ROWS = 2;
22 
26  const DEFAULT_COLS = 15;
27 
34  public function __construct(
35  Factory $factoryElement,
36  CollectionFactory $factoryCollection,
37  Escaper $escaper,
38  $data = []
39  ) {
40  parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
41  $this->setType('textarea');
42  $this->setExtType('textarea');
43  if (!$this->getRows()) {
44  $this->setRows(self::DEFAULT_ROWS);
45  }
46  if (!$this->getCols()) {
47  $this->setCols(self::DEFAULT_COLS);
48  }
49  }
50 
56  public function getHtmlAttributes()
57  {
58  return [
59  'title',
60  'class',
61  'style',
62  'onclick',
63  'onchange',
64  'rows',
65  'cols',
66  'readonly',
67  'disabled',
68  'onkeyup',
69  'tabindex',
70  'data-form-part',
71  'data-role',
72  'data-action'
73  ];
74  }
75 
81  public function getElementHtml()
82  {
83  $this->addClass('textarea admin__control-textarea');
84  $html = '<textarea id="' . $this->getHtmlId() . '" name="' . $this->getName() . '" '
85  . $this->serialize($this->getHtmlAttributes()) . $this->_getUiId() . ' >';
86  $html .= $this->getEscapedValue();
87  $html .= "</textarea>";
88  $html .= $this->getAfterElementHtml();
89  return $html;
90  }
91 }
serialize($attributes=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
__construct(Factory $factoryElement, CollectionFactory $factoryCollection, Escaper $escaper, $data=[])
Definition: Textarea.php:34