Skip to content

Commit

Permalink
[5.1] Use Dialog for ContentHistory field (#42454)
Browse files Browse the repository at this point in the history
Use new Dialog for ContentHistory field
  • Loading branch information
Fedik authored Dec 15, 2023
1 parent 47e0fae commit f36a3e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
29 changes: 11 additions & 18 deletions layouts/joomla/form/field/contenthistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;

extract($displayData);
Expand Down Expand Up @@ -51,27 +50,21 @@
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/

echo HTMLHelper::_(
'bootstrap.renderModal',
'versionsModal',
[
'url' => Route::_($link),
'title' => $label,
'height' => '100%',
'width' => '100%',
'modalWidth' => '80',
'bodyHeight' => '60',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
]
);
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('joomla.dialog-autocreate');

$dialogOptions = [
'popupType' => 'iframe',
'src' => Route::_($link, false),
'textHeader' => $label,
];

?>
<button
type="button"
class="btn btn-secondary"
data-bs-toggle="modal"
data-bs-target="#versionsModal"
data-joomla-dialog="<?php echo $this->escape(json_encode($dialogOptions, JSON_UNESCAPED_SLASHES)); ?>"
<?php echo $dataAttribute; ?>>
<span class="icon-code-branch" aria-hidden="true"></span>
<?php echo $label; ?>
Expand Down
2 changes: 1 addition & 1 deletion layouts/joomla/toolbar/versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<joomla-toolbar-button id="toolbar-versions">
<button
class="btn btn-primary"
data-joomla-dialog="<?php echo $this->escape(json_encode($dialogOptions)); ?>"
data-joomla-dialog="<?php echo $this->escape(json_encode($dialogOptions, JSON_UNESCAPED_SLASHES)); ?>"
type="button">
<span class="icon-code-branch" aria-hidden="true"></span>
<?php echo $title; ?>
Expand Down
2 changes: 1 addition & 1 deletion templates/cassiopeia/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<jdoc:include type="styles" />
<jdoc:include type="scripts" />
</head>
<body class="<?php echo $this->direction === 'rtl' ? 'rtl' : ''; ?>">
<body class="contentpane component <?php echo $this->direction === 'rtl' ? 'rtl' : ''; ?>">
<jdoc:include type="message" />
<jdoc:include type="component" />
</body>
Expand Down

0 comments on commit f36a3e0

Please sign in to comment.