Text.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Data\Form\Element;
  7. use Magento\Framework\Escaper;
  8. /**
  9. * Form text element
  10. */
  11. class Text extends AbstractElement
  12. {
  13. /**
  14. * @param Factory $factoryElement
  15. * @param CollectionFactory $factoryCollection
  16. * @param Escaper $escaper
  17. * @param array $data
  18. */
  19. public function __construct(
  20. Factory $factoryElement,
  21. CollectionFactory $factoryCollection,
  22. Escaper $escaper,
  23. $data = []
  24. ) {
  25. parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
  26. $this->setType('text');
  27. $this->setExtType('textfield');
  28. }
  29. /**
  30. * Get the HTML
  31. *
  32. * @return mixed
  33. */
  34. public function getHtml()
  35. {
  36. $this->addClass('input-text admin__control-text');
  37. return parent::getHtml();
  38. }
  39. /**
  40. * Get the attributes
  41. *
  42. * @return string[]
  43. */
  44. public function getHtmlAttributes()
  45. {
  46. return [
  47. 'type',
  48. 'title',
  49. 'class',
  50. 'style',
  51. 'onclick',
  52. 'onchange',
  53. 'onkeyup',
  54. 'disabled',
  55. 'readonly',
  56. 'maxlength',
  57. 'tabindex',
  58. 'placeholder',
  59. 'data-form-part',
  60. 'data-role',
  61. 'data-validation-params',
  62. 'data-action'
  63. ];
  64. }
  65. }