Project

General

Profile

Actions

Bug #98354

open

colClear for colums in TCA palettes with numberOfItems > 4

Added by Julian Hofmann over 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-09-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I had 7 fields of type checkbox within a palette. The items have been arranged in two columns - but why?

The calculation is done in \TYPO3\CMS\Backend\Form\Container\PaletteAndSingleContainer::renderInnerPaletteContent() by `$colWidth = (int)floor(12 / $numberOfItems);`.

Let's calculate some values:

numberOfItems: 1 - colWidth: 12
numberOfItems: 2 - colWidth: 6
numberOfItems: 3 - colWidth: 4
numberOfItems: 4 - colWidth: 3
numberOfItems: 5 - colWidth: 2
numberOfItems: 6 - colWidth: 2
numberOfItems: 7 - colWidth: 1
numberOfItems: 8 - colWidth: 1
numberOfItems: 9 - colWidth: 1
numberOfItems: 10 - colWidth: 1
numberOfItems: 11 - colWidth: 1
numberOfItems: 12 - colWidth: 1

For all $numberOfItems > 4, you'll get $colWidth <= 2 with results in CSS classes "col-sm-6 col-md-3 col-lg-2". For large screens we'll have 6 columns.

But ... There's a logic for 'colClear'-elements, too. These are inserted (for $colWidth <= 2) after each second, fourth and sixth item. With these clearers the behavior of colWidth brakes: e.g. 7 items are arranged in 6 columns, each with width 16,77%, but due to the colClear-elements the output is only two-columned.

I'm not sure if it's really a bug, because someone obviously gave some thought to the introduction of the colClear elements, but I see potential for optimization.

Tested in TYPO3 v11. Code seems unchanged in v12/master

Actions #1

Updated by Markus Klein about 1 year ago

Maybe our attempt https://review.typo3.org/c/Packages/TYPO3.CMS/+/76877 is a possible way to go?

Actions

Also available in: Atom PDF