Skip to content

Commit

Permalink
[5.0] Update bootstrap modal layout - add modalCss optional parameter (
Browse files Browse the repository at this point in the history
…joomla#40650)

* Update layouts bootstrap modal main.php

Add an optional parameter 'modalCss' to $params array

* Fixed code style

* Update code style

* Update layouts/libraries/html/bootstrap/modal/main.php

Co-authored-by: Quy <[email protected]>

---------

Co-authored-by: Quy <[email protected]>
Co-authored-by: Robert Deutz <[email protected]>
  • Loading branch information
3 people authored Jul 26, 2023
1 parent f8a6cf5 commit a8e363d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions layouts/libraries/html/bootstrap/modal/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* - bodyHeight int Optional height of the modal body in viewport units (vh)
* - modalWidth int Optional width of the modal in viewport units (vh)
* - footer string Optional markup for the modal footer
* - modalCss string Optional CSS classes of the modal
* @var string $body Markup for the modal body. Appended after the <iframe> if the URL option is set
*/

Expand All @@ -42,10 +43,14 @@
}

$modalWidth = isset($params['modalWidth']) ? round((int) $params['modalWidth'], -1) : '';
$modalDialogClass = '';
$modalDialogClass = 'modal-lg';

if ($modalWidth && $modalWidth > 0 && $modalWidth <= 100) {
$modalDialogClass = ' jviewport-width' . $modalWidth;
$modalDialogClass .= ' jviewport-width' . $modalWidth;
}

if (!empty($params['modalCss'])) {
$modalDialogClass = $params['modalCss'];
}

$modalAttributes = [
Expand All @@ -67,7 +72,7 @@
}
?>
<div id="<?php echo $selector; ?>" role="dialog" <?php echo ArrayHelper::toString($modalAttributes); ?> <?php echo $url ?? ''; ?> <?php echo isset($url) ? 'data-iframe="' . trim($iframeHtml) . '"' : ''; ?>>
<div class="modal-dialog modal-lg<?php echo $modalDialogClass; ?>">
<div class="modal-dialog <?php echo $modalDialogClass; ?>">
<div class="modal-content">
<?php
// Header
Expand Down

0 comments on commit a8e363d

Please sign in to comment.