Commit d82bc6c5 authored by Christian Eßl's avatar Christian Eßl Committed by Benni Mack
Browse files

[BUGFIX] Respect newContentElementWizard TSconfig in fluid based page module

The fluid based page module, introduced in v10 and the only
available variant since v11, does now correctly respect the
TSconfig options 'mod.web_layout.disableNewContentElementWizard'
and 'mod.newContentElementWizard.override' again.

Resolves: #92504
Releases: master, 10.4
Change-Id: I0a1f04e700ecaf131e735e05d6fc36c2bf313dc3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66071

Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent df6e0617
......@@ -160,17 +160,37 @@ class GridColumn extends AbstractGridObject
public function getNewContentUrl(): string
{
$pageId = $this->context->getPageId();
$urlParameters = [
'id' => $pageId,
'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId(),
'colPos' => $this->getColumnNumber(),
'uid_pid' => $pageId,
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$routeName = BackendUtility::getPagesTSconfig($pageId)['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$pageId = $this->context->getPageId();
if ($this->context->getDrawingConfiguration()->getShowNewContentWizard()) {
$urlParameters = [
'id' => $pageId,
'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId(),
'colPos' => $this->getColumnNumber(),
'uid_pid' => $pageId,
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$routeName = BackendUtility::getPagesTSconfig($pageId)['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
} else {
$urlParameters = [
'edit' => [
'tt_content' => [
$pageId => 'new'
]
],
'defVals' => [
'tt_content' => [
'colPos' => $this->getColumnNumber(),
'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId()
]
],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$routeName = 'record_edit';
}
return (string)$uriBuilder->buildUriFromRoute($routeName, $urlParameters);
}
......
......@@ -262,17 +262,31 @@ class GridColumnItem extends AbstractGridObject
public function getNewContentAfterUrl(): string
{
$pageId = $this->context->getPageId();
$urlParameters = [
'id' => $pageId,
'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId(),
'colPos' => $this->column->getColumnNumber(),
'uid_pid' => -$this->record['uid'],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$routeName = BackendUtility::getPagesTSconfig($pageId)['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$pageId = $this->context->getPageId();
if ($this->context->getDrawingConfiguration()->getShowNewContentWizard()) {
$urlParameters = [
'id' => $pageId,
'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId(),
'colPos' => $this->column->getColumnNumber(),
'uid_pid' => -$this->record['uid'],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$routeName = BackendUtility::getPagesTSconfig($pageId)['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
} else {
$urlParameters = [
'edit' => [
'tt_content' => [
-$this->record['uid'] => 'new'
]
],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$routeName = 'record_edit';
}
return (string)$uriBuilder->buildUriFromRoute($routeName, $urlParameters);
}
......
......@@ -23,7 +23,7 @@
<div class="t3-page-ce t3js-page-ce" data-page="{column.context.pageId}" id="{column.uniqueId}">
<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-{column.columnNumber}-page-{column.context.pageId}-{column.uniqueId}">
<a href="{column.newContentUrl}" title="{newContentTitle}" data-title="{newContentTitle}"
class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard disabled">
class="btn btn-default btn-sm {f:if(condition:column.context.drawingConfiguration.showNewContentWizard, then: 't3js-toggle-new-content-element-wizard disabled')}">
<core:icon identifier="actions-add" />
{newContentTitleShort}
</a>
......
......@@ -17,7 +17,8 @@
</div>
<f:if condition="{allowEditContent} && {item.column.contentEditable} && {item.column.context.allowNewContent}">
<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-{item.column.columnNumber}-page-{item.context.pageId}-{item.column.uniqueId}">
<a href="{item.newContentAfterUrl}" title="{item.newContentAfterLinkTitle}" data-title="{item.newContentAfterLinkTitle}" class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard disabled">
<a href="{item.newContentAfterUrl}" title="{item.newContentAfterLinkTitle}" data-title="{item.newContentAfterLinkTitle}"
class="btn btn-default btn-sm {f:if(condition:item.column.context.drawingConfiguration.showNewContentWizard, then: 't3js-toggle-new-content-element-wizard disabled')}">
<core:icon identifier="actions-add" />
{item.newContentAfterTitle}
</a>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment