Review main Merged

83143[FEATURE] Introduce tree node labels

Benjamin Kott CR +2 V +2 Hard +276 −17 updated 03/01/24, 11:03

Commit message

We've upgraded the backend tree component by extending tree nodes to
incorporate labels, offering enhanced functionality and additional
information.

Before the implementation of labels, developers and integrators
relied on `pageTree.backgroundColor.<pageid>` for visual cues.
However, these background colors lacked accessibility and meaningful
context, catering only to users with perfect eyesight and excluding
those dependent on screen readers or contrast modes.

With labels, we now cater to all editors. These labels not only offer
customizable color markings for tree nodes but also require an
associated label for improved accessibility.

Each node can support multiple labels, sorted by priority, with the
highest priority label taking precedence over others. Users can
assign a label to a node via tsconfig, noting that only one label
can be set through this method.

```
options.pageTree.label.<pageid> {
    label = Campaign A
    color = #ff8700
}
```

The labels can also be added by using the event
`\TYPO3\CMS\Backend\Controller\Event\AfterPageTreeItemsPreparedEvent`.

```
$items = $event->getItems();
foreach ($items as &$item) {
    $item['labels'][] = new Label(
        label: 'Campaign B',
        color: #00658f,
        priority: 1,
    );
}
```

Please note that only the marker for the label with the highest priority
is rendered. All additional labels will only be added to the title of
the node.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 21