Skip to content

Commit 91aa29b

Browse files
committed
Fix edit mask markup compatibility with Contao 5.5
1 parent f1c8774 commit 91aa29b

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/CustomElements.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ protected function createDca($dc, $type, $createFromPost = false, $tmpField = nu
651651
}
652652
}
653653

654-
$GLOBALS['TL_DCA'][$dc->table]['fields']['rsce_data']['eval']['rsceScript'] = 'window.rsceInit([...document.querySelectorAll("script")].pop().parentNode.parentNode.parentNode);';
654+
$GLOBALS['TL_DCA'][$dc->table]['fields']['rsce_data']['eval']['rsceScript'] = 'window.rsceInit([...document.querySelectorAll("script")].pop().closest(".tl_formbody_edit"));';
655655

656656
$paletteFields[] = 'rsce_data';
657657

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
<?php
2-
echo $this->generate();
1+
<?php /* closing the parent div element to make nested elements possible */ ?>
2+
</div><?php if (version_compare(Contao\CoreBundle\ContaoCoreBundle::getVersion(), '5.4', '>=')): ?></div><?php endif ?>
3+
<?= $this->generate() ?>
4+
<?php /* starting a div element to keep the correct element structure */ ?>
5+
<?php if (version_compare(Contao\CoreBundle\ContaoCoreBundle::getVersion(), '5.4', '>=')): ?><div class="widget-group"><?php endif ?><div style="display: none">
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php /* closing the parent div element to make nested elements possible */ ?>
2-
</div>
2+
</div><?php if (version_compare(Contao\CoreBundle\ContaoCoreBundle::getVersion(), '5.4', '>=')): ?></div><?php endif ?>
33
<?= $this->generate() ?>
44
<?php /* starting a div element to keep the correct element structure */ ?>
5-
<div style="display: none">
5+
<?php if (version_compare(Contao\CoreBundle\ContaoCoreBundle::getVersion(), '5.4', '>=')): ?><div class="widget-group"><?php endif ?><div style="display: none">
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php /* closing the parent div element to make nested elements possible */ ?>
2-
</div>
2+
</div><?php if (version_compare(Contao\CoreBundle\ContaoCoreBundle::getVersion(), '5.4', '>=')): ?></div><?php endif ?>
33
<?= $this->generate() ?>
44
<?php /* starting a div element to keep the correct element structure */ ?>
5-
<div style="display: none">
5+
<?php if (version_compare(Contao\CoreBundle\ContaoCoreBundle::getVersion(), '5.4', '>=')): ?><div class="widget-group"><?php endif ?><div style="display: none">

src/Widget/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Data extends Widget
3434
*/
3535
public function generate()
3636
{
37-
return '</div></fieldset><fieldset class="tl_box" style="border: 0; margin: 0; padding: 0"><div class="widget">'
37+
return '</fieldset><fieldset class="tl_box" style="border: 0; margin: 0; padding: 0">'
3838
. '<input type="hidden" name="'.$this->strName.'" value="">'
3939
. ($this->rsceScript ? '<script>'.$this->rsceScript.'</script>' : '');
4040
}

0 commit comments

Comments
 (0)