Skip to content
Snippets Groups Projects
Commit 93e6d6d8 authored by Benjamin Kott's avatar Benjamin Kott
Browse files

[FEATURE] Introduce tree node labels

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.

Resolves: #103211
Releases: main
Change-Id: I5daaa1efe6e11c506bd5f5f86770bf9895bb6789
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83143


Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: default avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: default avatarBenjamin Franzke <ben@bnf.dev>
Reviewed-by: default avatarBenjamin Franzke <ben@bnf.dev>
parent 3cf86c37
Branches
Tags
No related merge requests found
Showing
with 275 additions and 16 deletions
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