From 88ade1423f05c17ea7f0dfd3474b25160d3285ce Mon Sep 17 00:00:00 2001 From: Daniel Goerz <daniel.goerz@posteo.de> Date: Mon, 23 Mar 2020 20:37:05 +0100 Subject: [PATCH] [BUGFIX] Reimplement check for readonly title in link browser The check was removed with https://review.typo3.org/c/Packages/TYPO3.CMS/+/53481 However, it is still needed and therefore reinstalled. Resolves: #90202 Releases: master, 9.5 Change-Id: Ib92b610ea744b41553245a80922080d3ab42a3ea Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63883 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Susanne Moog <look@susi.dev> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Susanne Moog <look@susi.dev> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> --- .../Controller/BrowseLinksController.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php index 62e266d7adb4..ab148fa9e4bf 100644 --- a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php +++ b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php @@ -192,6 +192,7 @@ class BrowseLinksController extends AbstractLinkBrowserController ]; if (is_array($this->thisConfig['classesAnchor'])) { + $readOnlyTitle = $this->isReadonlyTitle(); foreach ($this->thisConfig['classesAnchor'] as $label => $conf) { if (in_array($conf['class'], $classesAnchorArray, true)) { $classesAnchor['all'][] = $conf['class']; @@ -207,7 +208,7 @@ class BrowseLinksController extends AbstractLinkBrowserController } } } - if ($conf['titleText']) { + if ($readOnlyTitle && $conf['titleText']) { $this->classesAnchorClassTitle[$conf['class']] = ($this->classesAnchorDefaultTitle[$conf['type']] = $this->contentLanguageService->sL(trim($conf['titleText']))); } } @@ -431,15 +432,9 @@ class BrowseLinksController extends AbstractLinkBrowserController } else { $title = $this->classesAnchorDefaultTitle[$this->displayedLinkHandlerId] ?: ''; } - if (isset($this->buttonConfig[$this->displayedLinkHandlerId]['properties']['title']['readOnly'])) { - $readOnly = (bool)$this->buttonConfig[$this->displayedLinkHandlerId]['properties']['title']['readOnly']; - } else { - $readOnly = isset($this->buttonConfig['properties']['title']['readOnly']) - ? (bool)$this->buttonConfig['properties']['title']['readOnly'] - : false; - } + $readOnlyTitle = $this->isReadonlyTitle(); - if ($readOnly) { + if ($readOnlyTitle) { $currentClass = $this->linkAttributeFields['class']; if (!$currentClass) { $currentClass = empty($this->classesAnchorDefault[$this->displayedLinkHandlerId]) ? '' : $this->classesAnchorDefault[$this->displayedLinkHandlerId]; @@ -453,7 +448,7 @@ class BrowseLinksController extends AbstractLinkBrowserController ' . htmlspecialchars($this->getLanguageService()->getLL('title')) . ' </label> <div class="col-xs-8"> - <input ' . ($readOnly ? 'disabled' : '') . ' type="text" name="ltitle" class="form-control t3js-linkTitle" + <input ' . ($readOnlyTitle ? 'disabled' : '') . ' type="text" name="ltitle" class="form-control t3js-linkTitle" value="' . htmlspecialchars($title) . '" /> </div> </div> @@ -537,4 +532,13 @@ class BrowseLinksController extends AbstractLinkBrowserController 'contentsLanguage' => $this->contentsLanguage ]; } + + protected function isReadonlyTitle(): bool + { + if (isset($this->buttonConfig[$this->displayedLinkHandlerId]['properties']['title']['readOnly'])) { + return (bool)$this->buttonConfig[$this->displayedLinkHandlerId]['properties']['title']['readOnly']; + } + + return (bool)($this->buttonConfig['properties']['title']['readOnly'] ?? false); + } } -- GitLab