| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Copyright © O2TI. All rights reserved. |
||
| 4 | * |
||
| 5 | * @author Bruno Elisei <[email protected]> |
||
| 6 | * See COPYING.txt for license details. |
||
| 7 | */ |
||
| 8 | |||
| 9 | declare(strict_types=1); |
||
| 10 | |||
| 11 | namespace O2TI\AdvancedFieldsCheckout\Block\Adminhtml\Form\Field\Column; |
||
| 12 | |||
| 13 | use Magento\Framework\View\Element\Html\Select; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Class FieldIsBreakLineColumn - Create Field to BreakLine. |
||
| 17 | */ |
||
| 18 | class FieldIsBreakLineColumn extends Select |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * Value which equal Enable for Enabledisable dropdown. |
||
| 22 | */ |
||
| 23 | public const ENABLE_VALUE = 1; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Value which equal Disable for Enabledisable dropdown. |
||
| 27 | */ |
||
| 28 | public const DISABLE_VALUE = 0; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Set "name" for <select> element. |
||
| 32 | * |
||
| 33 | * @param string $value |
||
| 34 | * |
||
| 35 | * @return $this |
||
| 36 | */ |
||
| 37 | public function setInputName($value) |
||
| 38 | { |
||
| 39 | return $this->setName($value); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Set "id" for <select> element. |
||
| 44 | * |
||
| 45 | * @param string $value |
||
| 46 | * |
||
| 47 | * @return $this |
||
| 48 | */ |
||
| 49 | public function setInputId($value) |
||
| 50 | { |
||
| 51 | return $this->setId($value); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Render block HTML. |
||
| 56 | * |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function _toHtml(): string |
||
| 60 | { |
||
| 61 | if (!$this->getOptions()) { |
||
| 62 | $this->setOptions($this->getSourceOptions()); |
||
| 63 | } |
||
| 64 | |||
| 65 | return parent::_toHtml(); |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Render Options. |
||
| 70 | * |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | private function getSourceOptions(): array |
||
| 74 | { |
||
| 75 | return [ |
||
| 76 | ['value' => self::ENABLE_VALUE, 'label' => __('Enable')], |
||
| 77 | ['value' => self::DISABLE_VALUE, 'label' => __('Disable')], |
||
| 78 | ]; |
||
| 79 | } |
||
| 80 | } |
||
| 81 |