Skip to content

Commit

Permalink
Merge tag '2.1.3'
Browse files Browse the repository at this point in the history
Hotfix release 2.1.3

- Save HTML code in textarea with rte
- Disable html5 validation if button with nosave css class
- Fix broken phpmd in travis
  • Loading branch information
stefanheimes committed Jan 4, 2022
2 parents 7a29cdb + 112c8e6 commit 5f6caa0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
},
"require-dev": {
"contao/manager-plugin": "^2.1",
"phpcq/all-tasks": "~1.1"
"phpcq/all-tasks": "~1.1",
"phpmd/phpmd": "~2.8.2"
},
"autoload": {
"psr-4": {
Expand Down
20 changes: 16 additions & 4 deletions src/Resources/contao/templates/dcfe_general_edit.html5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general-contao-frontend.
*
* (c) 2015 Contao Community Alliance.
* (c) 2015-2021 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -12,7 +12,8 @@
*
* @package contao-community-alliance/dc-general-contao-frontend
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @copyright 2015 Contao Community Alliance.
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2015-2021 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general-contao-frontend/blob/master/LICENSE LGPL-3.0
* @filesource
*/
Expand All @@ -26,12 +27,12 @@
enctype="<?= $this->enctype; ?>"
>
<div class="formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="<?= specialchars($this->table); ?>"/>
<input type="hidden" name="FORM_SUBMIT" value="<?= \Contao\StringUtil::specialchars($this->table); ?>"/>
<input type="hidden" name="REQUEST_TOKEN" value="<?= REQUEST_TOKEN; ?>"/>
<?php if ($this->error): ?><p class="tl_error"><?= implode('<br />', $this->error); ?></p><?php endif; ?>
<?php foreach ($this->fieldsets as $arrFieldset): ?>
<?php if ($arrFieldset['legend']): ?>
<fieldset id="pal_<?= specialchars($arrFieldset['legend']); ?>"
<fieldset id="pal_<?= \Contao\StringUtil::specialchars($arrFieldset['legend']); ?>"
class="<?= $arrFieldset['class']; ?> block">
<legend><?= $arrFieldset['label']; ?></legend>
<?= $arrFieldset['palette']; ?>
Expand All @@ -49,3 +50,14 @@
</div>
</div>
</form>
<?php
$GLOBALS['TL_BODY'][] = '
<script>
const form = document.getElementById("' . $this->table . '");
form.querySelectorAll("button.notsave").forEach(abortButton => {
abortButton.addEventListener("click", () => {
form.noValidate = true;
}, true);
});
</script>';
?>
11 changes: 9 additions & 2 deletions src/View/WidgetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general-contao-frontend.
*
* (c) 2015-2019 Contao Community Alliance.
* (c) 2015-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,13 +13,15 @@
* @package contao-community-alliance/dc-general-contao-frontend
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
* @copyright 2015-2019 Contao Community Alliance.
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2015-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general-contao-frontend/blob/master/LICENSE LGPL-3.0
* @filesource
*/

namespace ContaoCommunityAlliance\DcGeneral\ContaoFrontend\View;

use Contao\FormTextArea;
use Contao\Input;
use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\Event\BuildWidgetEvent;
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\EncodePropertyValueFromWidgetEvent;
Expand Down Expand Up @@ -205,6 +207,11 @@ private function processProperty(PropertyValueBag $valueBag, $property)
}

try {
// See https://github.com/contao/contao/blob/7e6bacd4e/core-bundle/src/Resources/contao/forms/FormTextArea.php#L147
if ($widget instanceof FormTextArea) {
$valueBag->setPropertyValue($property, $this->encodeValue($property, $widget->rawValue, $valueBag));
return;
}
$valueBag->setPropertyValue($property, $this->encodeValue($property, $widget->value, $valueBag));
} catch (\Exception $e) {
$widget->addError($e->getMessage());
Expand Down

0 comments on commit 5f6caa0

Please sign in to comment.