Skip to content

Commit

Permalink
Improved ModalToggle declaration: reduced verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed May 29, 2024
1 parent 73ab708 commit 2f229f5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Screen/Actions/ModalToggle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 2f229f5

Please sign in to comment.