Skip to content

Commit f36a3e0

Browse files
authored
[5.1] Use Dialog for ContentHistory field (#42454)
Use new Dialog for ContentHistory field
1 parent 47e0fae commit f36a3e0

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

layouts/joomla/form/field/contenthistory.php

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
defined('_JEXEC') or die;
1212

13-
use Joomla\CMS\HTML\HTMLHelper;
14-
use Joomla\CMS\Language\Text;
13+
use Joomla\CMS\Factory;
1514
use Joomla\CMS\Router\Route;
1615

1716
extract($displayData);
@@ -51,27 +50,21 @@
5150
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
5251
*/
5352

54-
echo HTMLHelper::_(
55-
'bootstrap.renderModal',
56-
'versionsModal',
57-
[
58-
'url' => Route::_($link),
59-
'title' => $label,
60-
'height' => '100%',
61-
'width' => '100%',
62-
'modalWidth' => '80',
63-
'bodyHeight' => '60',
64-
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-hidden="true">'
65-
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
66-
]
67-
);
53+
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
54+
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
55+
$wa->useScript('joomla.dialog-autocreate');
56+
57+
$dialogOptions = [
58+
'popupType' => 'iframe',
59+
'src' => Route::_($link, false),
60+
'textHeader' => $label,
61+
];
6862

6963
?>
7064
<button
7165
type="button"
7266
class="btn btn-secondary"
73-
data-bs-toggle="modal"
74-
data-bs-target="#versionsModal"
67+
data-joomla-dialog="<?php echo $this->escape(json_encode($dialogOptions, JSON_UNESCAPED_SLASHES)); ?>"
7568
<?php echo $dataAttribute; ?>>
7669
<span class="icon-code-branch" aria-hidden="true"></span>
7770
<?php echo $label; ?>

layouts/joomla/toolbar/versions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<joomla-toolbar-button id="toolbar-versions">
5353
<button
5454
class="btn btn-primary"
55-
data-joomla-dialog="<?php echo $this->escape(json_encode($dialogOptions)); ?>"
55+
data-joomla-dialog="<?php echo $this->escape(json_encode($dialogOptions, JSON_UNESCAPED_SLASHES)); ?>"
5656
type="button">
5757
<span class="icon-code-branch" aria-hidden="true"></span>
5858
<?php echo $title; ?>

templates/cassiopeia/component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<jdoc:include type="styles" />
8282
<jdoc:include type="scripts" />
8383
</head>
84-
<body class="<?php echo $this->direction === 'rtl' ? 'rtl' : ''; ?>">
84+
<body class="contentpane component <?php echo $this->direction === 'rtl' ? 'rtl' : ''; ?>">
8585
<jdoc:include type="message" />
8686
<jdoc:include type="component" />
8787
</body>

0 commit comments

Comments
 (0)