From 2f229f5faea1f1855e58a98c90cfd99a798cedbc Mon Sep 17 00:00:00 2001 From: tabuna Date: Wed, 29 May 2024 13:56:52 +0300 Subject: [PATCH] Improved `ModalToggle` declaration: reduced verbosity --- src/Screen/Actions/ModalToggle.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Screen/Actions/ModalToggle.php b/src/Screen/Actions/ModalToggle.php index ab451e357..5ae0ca52e 100644 --- a/src/Screen/Actions/ModalToggle.php +++ b/src/Screen/Actions/ModalToggle.php @@ -10,7 +10,6 @@ * Class ModalToggle. * * @method ModalToggle name(string $name = null) - * @method ModalToggle modal(string $modalName = null) * @method ModalToggle icon(string $icon = null) * @method ModalToggle class(string $classes = null) * @method ModalToggle modalTitle(string $title) @@ -50,4 +49,21 @@ public function asyncParameters($options = []): self ->parameters(Arr::wrap($options)) ->set('async', 'true'); } + + /** + * @param string $name + * @param array $options + * + * @return $this|\Orchid\Screen\Actions\Button + */ + public function modal(string $name, array $options = []) + { + $this->set('modal', $name); + + if(!empty($options)) { + $this->asyncParameters($options); + } + + return $this; + } }