Commit 0893b693 authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Fix page layout grid columns

This fixes inconsistency in the display of the grid columns
between the fluid based page module and PageLayoutView.

* Proper distinction between unassigned and unused columns
* State describing classes, such as "restricted" and "hidden"
  are now added correctly
* Access restricted columns do not longer display elements
  previously added to this column
* Column titles are now correct
* TSconfig option "hideRestrictedCols" is respected
* TSconfig option "colPosList" does now work correctly
* All used labels are now translatable
* No more cross dependencies for labels

Resolves: #94602
Related: #93829
Related: #93313
Releases: master
Change-Id: I1d1e641722d57657169e16e92ddd501aab04bc72
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70013

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
parent c9e22a8f
......@@ -220,6 +220,9 @@ class BackendLayout
return $this->structure;
}
/**
* @return string[]
*/
public function getColumnPositionNumbers(): array
{
return $this->structure['__colPosList'];
......
......@@ -72,7 +72,7 @@ class GridColumn extends AbstractGridObject
public function __construct(PageLayoutContext $context, array $columnDefinition)
{
parent::__construct($context);
$this->columnNumber = isset($columnDefinition['colPos']) ? (int)$columnDefinition['colPos'] : $this->columnNumber;
$this->columnNumber = isset($columnDefinition['colPos']) ? (int)$columnDefinition['colPos'] : null;
$this->columnName = $columnDefinition['name'] ?? $this->columnName;
$this->icon = $columnDefinition['icon'] ?? $this->icon;
$this->colSpan = (int)($columnDefinition['colspan'] ?? $this->colSpan);
......@@ -213,12 +213,17 @@ class GridColumn extends AbstractGridObject
public function getTitleUnassigned(): string
{
return $this->getTitle() . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')';
return $this->getLanguageService()->sL($this->columnName) . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')';
}
public function isUnassigned(): bool
{
return $this->columnNumber === null;
return $this->columnName !== 'unused' && $this->columnNumber === null;
}
public function isUnused(): bool
{
return $this->columnName === 'unused' && $this->columnNumber === null;
}
public function isContentEditable(): bool
......
......@@ -86,7 +86,8 @@ class GridColumnItem extends AbstractGridObject
$wrapperClassNames = [];
if ($this->isDisabled()) {
$wrapperClassNames[] = 't3-page-ce-hidden t3js-hidden-record';
} elseif (!in_array($this->record['colPos'], $this->context->getBackendLayout()->getColumnPositionNumbers())) {
}
if (!in_array((string)$this->record['colPos'], $this->context->getBackendLayout()->getColumnPositionNumbers(), true)) {
$wrapperClassNames[] = 't3-page-ce-warning';
}
......
......@@ -514,7 +514,7 @@ class PageLayoutView implements LoggerAwareInterface
$queue = $service->getMessageQueueByIdentifier();
$queue->addMessage($unusedElementsMessage);
}
$colTitle = $this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:colPos.I.unused');
$colTitle = $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:unusedColPos');
$editParam = '';
} else {
$colTitle = '';
......
......@@ -159,6 +159,15 @@
<trans-unit id="notAssigned" resname="notAssigned">
<source>Not assigned</source>
</trans-unit>
<trans-unit id="emptyColPos" resname="emptyColPos">
<source>Empty Colpos</source>
</trans-unit>
<trans-unit id="emptyColPos.message" resname="emptyColPos.message">
<source>This column has no "colPos". This is only for display Purposes.</source>
</trans-unit>
<trans-unit id="unusedColPos" resname="unusedColPos">
<source>Unused</source>
</trans-unit>
<trans-unit id="undoLastChange" resname="undoLastChange">
<source>Undo/Redo last change (%s ago)</source>
</trans-unit>
......
<f:comment>
Styling requires the colpos to be set to the string 'unused'. To preserve type safty in the
controller, the string is only used in the template by setting the below "colpos" variable.
</f:comment>
<f:variable name="colpos" value="{f:if(condition: column.unused, then: 'unused', else: column.columnNumber)}"/>
<td valign="top" colspan="{column.colSpan}" rowspan="{column.rowSpan}"
data-colpos="{column.columnNumber}" data-language-uid="{column.context.siteLanguage.languageId}"
class="t3js-page-lang-column-{column.context.siteLanguage.languageId} t3js-page-column t3-grid-cell t3-page-column t3-page-column-{column.columnNumber}
{f:if(condition: column.active, else: 't3-grid-cell-unassigned')}
data-colpos="{colpos}" data-language-uid="{column.context.siteLanguage.languageId}"
class="t3js-page-lang-column-{column.context.siteLanguage.languageId} t3js-page-column t3-grid-cell t3-page-column t3-page-column-{colpos}
{f:if(condition: column.unassigned, then: 't3-grid-cell-unassigned')}
{f:if(condition: '!{column.active} && !{column.unused}', then: 't3-grid-cell-restricted')}
{f:if(condition: '!{column.active} && {hideRestrictedColumns} && !{column.unused}', then: 't3-grid-cell-hidden')}
t3-gridCell-width{column.colSpan}
t3-gridCell-height{column.rowSpan}">
<f:render partial="PageLayout/Grid/ColumnHeader" arguments="{_all}" />
<f:if condition="{column.unassigned}">
<div class="t3-page-ce">
<div class="t3-page-ce-header">Empty Colpos</div>
<div class="t3-page-ce-body">
<div class="t3-page-ce-body-inner">
<div class="row">
<div class="col-12">
This column has no "colPos". This is only for display Purposes.
<f:then>
<div class="t3-page-ce">
<div class="t3-page-ce-header"><f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:emptyColPos" /></div>
<div class="t3-page-ce-body">
<div class="t3-page-ce-body-inner">
<div class="row">
<div class="col-12">
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:emptyColPos.message" />
</div>
</div>
</div>
</div>
</div>
</div>
</f:if>
<f:if condition="{column.items}">
<div data-colpos="{column.columnNumber}" data-language-uid="{column.context.siteLanguage.languageId}"
class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-{column.context.siteLanguage.languageId} t3-page-ce-wrapper
{f:if(condition: column.items, else: 't3-page-ce-empty')}">
<f:for each="{column.items}" as="item">
<f:render partial="PageLayout/Record" arguments="{_all}" />
</f:for>
</div>
</f:then>
<f:else if="{column.active} || {column.unused}">
<div data-colpos="{colpos}" data-language-uid="{column.context.siteLanguage.languageId}"
class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-{column.context.siteLanguage.languageId} t3-page-ce-wrapper
{f:if(condition: column.items, else: 't3-page-ce-empty')}">
<f:for each="{column.items}" as="item">
<f:render partial="PageLayout/Record" arguments="{_all}" />
</f:for>
</div>
</f:else>
</f:if>
</td>
......@@ -8,6 +8,9 @@
</div>
{column.title}
</f:then>
<f:else if="{column.unused}">
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:unusedColPos"/>
</f:else>
<f:else if="{column.unassigned}">
{column.titleUnassigned}
</f:else>
......@@ -16,7 +19,7 @@
</f:else>
</f:if>
</div>
<f:if condition="{allowEditContent} && {column.contentEditable} && {column.context.allowNewContent}">
<f:if condition="{allowEditContent} && {column.contentEditable} && {column.context.allowNewContent} && {column.active}">
<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}"
......
......@@ -15,7 +15,7 @@
</f:render>
</div>
</div>
<f:if condition="{allowEditContent} && {item.column.contentEditable} && {item.column.context.allowNewContent}">
<f:if condition="{allowEditContent} && {item.column.contentEditable} && {item.column.context.allowNewContent} && {column.active}">
<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 {f:if(condition:item.column.context.drawingConfiguration.showNewContentWizard, then: 't3js-toggle-new-content-element-wizard disabled')}">
......
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