| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Ui\Form\Layout; |
| 6: | |
| 7: | use Atk4\Core\Factory; |
| 8: | use Atk4\Ui\Button; |
| 9: | use Atk4\Ui\Exception; |
| 10: | use Atk4\Ui\Form; |
| 11: | |
| 12: | class Custom extends Form\AbstractLayout |
| 13: | { |
| 14: | public $defaultTemplate; |
| 15: | |
| 16: | #[\Override] |
| 17: | protected function init(): void |
| 18: | { |
| 19: | parent::init(); |
| 20: | |
| 21: | if (!$this->template) { |
| 22: | throw new Exception('You must specify template for Form/Layout/Custom. Try [\'Custom\', \'defaultTemplate\' => \'./yourform.html\']'); |
| 23: | } |
| 24: | } |
| 25: | |
| 26: | #[\Override] |
| 27: | public function addButton($seed) |
| 28: | { |
| 29: | return $this->add(Factory::mergeSeeds([Button::class], $seed), 'Buttons'); |
| 30: | } |
| 31: | } |
| 32: | |