Label.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Data form abstract class
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Framework\Data\Form\Element;
  12. class Label extends \Magento\Framework\Data\Form\Element\AbstractElement
  13. {
  14. /**
  15. * @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
  16. * @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection
  17. * @param \Magento\Framework\Escaper $escaper
  18. * @param array $data
  19. */
  20. public function __construct(
  21. \Magento\Framework\Data\Form\Element\Factory $factoryElement,
  22. \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection,
  23. \Magento\Framework\Escaper $escaper,
  24. $data = []
  25. ) {
  26. parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
  27. $this->setType('label');
  28. }
  29. /**
  30. * Retrieve Element HTML
  31. *
  32. * @return string
  33. */
  34. public function getElementHtml()
  35. {
  36. $html = $this->getBold() ? '<div class="control-value special">' : '<div class="control-value">';
  37. $html .= $this->getEscapedValue() . '</div>';
  38. $html .= $this->getAfterElementHtml();
  39. return $html;
  40. }
  41. }