Skip to content

Commit

Permalink
pkp#10444 Remove titleIcon and instead add modalStyle param the to Mo…
Browse files Browse the repository at this point in the history
…dal classes
  • Loading branch information
blesildaramirez committed Oct 7, 2024
1 parent 78592d2 commit 10c7579
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
1 change: 1 addition & 0 deletions classes/form/FormBuilderVocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public function smartyFBVFormButtons($params, $smarty)
'FBV_cancelUrlTarget' => $params['cancelUrlTarget'] ?? '',
'FBV_translate' => $params['translate'] ?? true,
'FBV_saveText' => $params['saveText'] ?? null,
'FBV_modalStyle' => $params['modalStyle'] ?? null,
]);
return $smarty->fetch('form/formButtons.tpl');
}
Expand Down
6 changes: 3 additions & 3 deletions classes/linkAction/request/AjaxModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AjaxModal extends Modal
*
* @param string $url The URL of the AJAX resource to load into the modal.
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param bool $canClose (optional) Whether the modal will have a close button.
* @param string $closeOnFormSuccessId (optional) Close the modal when the
* form with this id fires a formSuccess event.
Expand All @@ -35,12 +35,12 @@ class AjaxModal extends Modal
public function __construct(
$url,
$title = null,
$titleIcon = null,
$modalStyle = 'default',
$canClose = true,
$closeOnFormSuccessId = null,
$closeCleanVueInstances = []
) {
parent::__construct($title, $titleIcon, $canClose, $closeOnFormSuccessId, $closeCleanVueInstances);
parent::__construct($title, $modalStyle, $canClose, $closeOnFormSuccessId, $closeCleanVueInstances);

$this->_url = $url;
}
Expand Down
7 changes: 3 additions & 4 deletions classes/linkAction/request/ConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ class ConfirmationModal extends Modal
* @param string $dialogText The localized text to appear
* in the dialog modal.
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used
* in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
* @param string $cancelButton (optional) The localized text to
* appear on the cancel button.
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($dialogText, $title = null, $titleIcon = 'modal_confirm', $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($dialogText, $title = null, $modalStyle = 'default', $okButton = null, $cancelButton = null, $canClose = true)
{
$title = (is_null($title) ? __('common.confirm') : $title);
parent::__construct($title, $titleIcon, $canClose);
parent::__construct($title, $modalStyle, $canClose);

$this->_okButton = (is_null($okButton) ? __('common.ok') : $okButton);
$this->_cancelButton = (is_null($cancelButton) ? __('common.cancel') : $cancelButton);
Expand Down
7 changes: 3 additions & 4 deletions classes/linkAction/request/JsEventConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,17 @@ class JsEventConfirmationModal extends ConfirmationModal
* @param string $event the name of the JS event.
* @param array $extraArguments (optional) extra information to be passed as JSON data with the event.
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used
* in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
* @param string $cancelButton (optional) The localized text to
* appear on the cancel button.
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true)
{
parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose);
parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose);

$this->_event = $event;
$this->_extraArguments = $extraArguments;
Expand Down
16 changes: 8 additions & 8 deletions classes/linkAction/request/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Modal extends LinkActionRequest
public $_title;

/** @var string The icon to be displayed in the title bar. */
public $_titleIcon;
public $_modalStyle;

/** @var bool Whether the modal has a close icon in the title bar. */
public $_canClose;
Expand All @@ -43,7 +43,7 @@ class Modal extends LinkActionRequest
* Constructor
*
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param bool $canClose (optional) Whether the modal will have a close button.
* @param string $closeOnFormSuccessId (optional) Close the modal when the
* form with this id fires a formSuccess event.
Expand All @@ -52,14 +52,14 @@ class Modal extends LinkActionRequest
*/
public function __construct(
$title = null,
$titleIcon = null,
$modalStyle = null,
$canClose = true,
$closeOnFormSuccessId = null,
$closeCleanVueInstances = []
) {
parent::__construct();
$this->_title = $title;
$this->_titleIcon = $titleIcon;
$this->_modalStyle = $modalStyle;
$this->_canClose = $canClose;
$this->_closeOnFormSuccessId = $closeOnFormSuccessId;
$this->_closeCleanVueInstances = $closeCleanVueInstances;
Expand All @@ -82,13 +82,13 @@ public function getTitle()
}

/**
* Get the title bar icon.
* Get the modal style.
*
* @return string
*/
public function getTitleIcon()
public function getModalStyle()
{
return $this->_titleIcon;
return $this->_modalStyle;
}

/**
Expand Down Expand Up @@ -128,7 +128,7 @@ public function getLocalizedOptions()
{
return [
'title' => $this->getTitle(),
'titleIcon' => $this->getTitleIcon(),
'modalStyle' => $this->getModalStyle(),
'canClose' => ($this->getCanClose() ? '1' : '0'),
'closeOnFormSuccessId' => $this->_closeOnFormSuccessId,
'closeCleanVueInstances' => $this->_closeCleanVueInstances,
Expand Down
7 changes: 3 additions & 4 deletions classes/linkAction/request/RedirectConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ class RedirectConfirmationModal extends ConfirmationModal
* @param string $title (optional) The localized modal title.
* @param string $remoteUrl (optional) A URL to be
* redirected to when the confirmation button is clicked.
* @param string $titleIcon (optional) The icon to be used
* in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
* @param string $cancelButton (optional) The localized text to
* appear on the cancel button.
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($dialogText, $title = null, $remoteUrl = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($dialogText, $title = null, $remoteUrl = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true)
{
parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose);
parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose);

$this->_remoteUrl = $remoteUrl;
}
Expand Down
6 changes: 3 additions & 3 deletions classes/linkAction/request/RemoteActionConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RemoteActionConfirmationModal extends ConfirmationModal
* @param string $title (optional) The localized modal title.
* @param string $remoteAction (optional) A URL to be
* called when the confirmation button is clicked.
* @param string $titleIcon (optional) The icon to be used
* @param string $modalStyle (optional) The modal state/style to be used.
* in the modal title bar.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
Expand All @@ -41,9 +41,9 @@ class RemoteActionConfirmationModal extends ConfirmationModal
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($session, $dialogText, $title = null, $remoteAction = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($session, $dialogText, $title = null, $remoteAction = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true)
{
parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose);
parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose);

$this->_remoteAction = $remoteAction;
$this->_csrfToken = $session->token();
Expand Down

0 comments on commit 10c7579

Please sign in to comment.