Skip to content

Commit

Permalink
no need for "modal_option" key, there is only 1 option
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 3, 2022
1 parent 7953ad8 commit ae438c2
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ class Modal extends View
public $args = [];
/** @var array */
public $options = [
'modal_option' => [
// any change in modal DOM should automatically refresh cached positions
// allow modal window to add scrolling when content is added after modal is created
'observeChanges' => true,
],
// any change in modal DOM should automatically refresh cached positions
// allow modal window to add scrolling when content is added after modal is created
'observeChanges' => true,
];

/** @var string Currently only "json" response type is supported. */
Expand Down Expand Up @@ -164,7 +162,7 @@ public function hide()
*/
public function setOption($option, $value)
{
$this->options['modal_option'][$option] = $value;
$this->options[$option] = $value;

return $this;
}
Expand Down Expand Up @@ -194,7 +192,7 @@ public function addDenyAction($label, $jsAction)
$button = new Button();
$button->set($label)->addClass('red cancel');
$this->addButtonAction($button);
$this->options['modal_option']['onDeny'] = $jsAction;
$this->options['onDeny'] = $jsAction;

return $this;
}
Expand All @@ -212,7 +210,7 @@ public function addApproveAction($label, $jsAction)
$b = new Button();
$b->set($label)->addClass('green ok');
$this->addButtonAction($b);
$this->options['modal_option']['onApprove'] = $jsAction;
$this->options['onApprove'] = $jsAction;

return $this;
}
Expand All @@ -239,7 +237,7 @@ public function addButtonAction($button)
*/
public function notClosable()
{
$this->options['modal_option']['closable'] = false;
$this->options['closable'] = false;

return $this;
}
Expand Down Expand Up @@ -267,9 +265,9 @@ protected function renderView(): void
$this->template->del('ActionContainer');
}

$this->js(true)->modal($this->options['modal_option']);
$this->js(true)->modal($this->options);

if (!isset($this->options['modal_option']['closable']) || $this->options['modal_option']['closable']) {
if (!isset($this->options['closable']) || $this->options['closable']) {
$this->template->trySet('closeIcon', 'close');
}

Expand Down

0 comments on commit ae438c2

Please sign in to comment.