Skip to content

Commit

Permalink
[FEATURE] Provide setting to hide restricted columns in page module
Browse files Browse the repository at this point in the history
The following TSConfig setting hides columns restricted via
mod.SHARED.colPos_list:

mod.web_layout.hideRestrictedCols = 1

Resolves: #83460
Releases: master
Change-Id: I0ccaa027d9a37530e6362675bf29679edc1d2a3d
Reviewed-on: https://review.typo3.org/55259
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
  • Loading branch information
steffenk authored and NeoBlack committed Feb 23, 2018
1 parent 349a7fa commit 84cdecc
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Build/Resources/Public/Sass/typo3/_module_web_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ $page-ce-dropzone-possible-border: $state-warning-border;
background-color: $page-grid-cell-restricted;
}

.t3-grid-cell-hidden {
display: none;
}

.t3-grid-cell-unassigned {
background: url('../../../../backend/Resources/Public/Images/Backgrounds/layout-not-assigned.png') repeat;
}
Expand Down
16 changes: 12 additions & 4 deletions typo3/sysext/backend/Classes/View/PageLayoutView.php
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,10 @@ public function getTable_tt_content($id)
$grid .= '<col />';
}
$grid .= '</colgroup>';

// Check how to handle restricted columns
$hideRestrictedCols = (bool)($tsConfig['properties']['web_layout.']['hideRestrictedCols'] ?? false);

// Cycle through rows
for ($row = 1; $row <= $rowCount; $row++) {
$rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
Expand All @@ -1186,7 +1190,7 @@ public function getTable_tt_content($id)
($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') .
' data-colpos="' . (int)$columnConfig['colPos'] . '" data-language-uid="' . $lP . '" class="t3js-page-lang-column-' . $lP . ' t3js-page-column t3-grid-cell t3-page-column t3-page-column-' . $columnKey .
((!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '') ? ' t3-grid-cell-unassigned' : '') .
((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ' t3-grid-cell-restricted' : '') .
((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ($hideRestrictedCols ? ' t3-grid-cell-restricted t3-grid-cell-hidden' : ' t3-grid-cell-restricted') : '') .
($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') .
($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">';

Expand All @@ -1199,12 +1203,16 @@ public function getTable_tt_content($id)
} elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
&& GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
) {
$grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'));
if (!$hideRestrictedCols) {
$grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'));
}
} elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
&& !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
) {
$grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
' (' . $this->getLanguageService()->getLL('noAccess') . ')');
if (!$hideRestrictedCols) {
$grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
' (' . $this->getLanguageService()->getLL('noAccess') . ')');
}
} elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
$grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name'])
. ' (' . $this->getLanguageService()->getLL('notAssigned') . ')');
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Resources/Public/Css/backend.css

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. include:: ../../Includes.txt

========================================================
Feature: #83460 - Hide restricted columns in page module
========================================================

See :issue:`83460`

Description
===========

In order to get a cleaner page layout view for backend users, an option to hide
the restricted columns in page module has been introduced.

When restricting a list of columns to the user, the restricted columns are
rendered with a message that the user has no access to these columns which might
be undesired in certain cases (imagine a user having access to only one of 20
columns total).

With assigning the following setting to the UserTS, these columns are hidden and
the user will only see the columns they are allowed to edit or add content to:

`mod.web_layout.hideRestrictedCols = 1`

If you use backend layouts to provide an abstract view of the frontend, hiding
the columns with this setting **will** break your layout, so handle it with care.


.. index:: Backend

0 comments on commit 84cdecc

Please sign in to comment.