Skip to content
Snippets Groups Projects
Commit cd8751d3 authored by Benjamin Kott's avatar Benjamin Kott Committed by Benni Mack
Browse files

[TASK] Enable strict typing for Icon::class and add title

This patch enables strict types for the Icon:class.

We are also introducing a fluent setter object pattern
for and introducing a title property that can set
to be rendered directly on the icon.

This will avoid unnessesary <span title="...">...</span>
wraps around rendered icons, since it can now be added
directly to the icon.

..  code-block:: php

    // Before
    $iconMarkup = '
        <span title="title">
            ' . $this->iconFactory->getIcon('actions-open')->render() . '
        </span>
    ';

    // After
    $iconMarkup = $this->iconFactory->getIcon('actions-open')
        ->setTitle('title')
        ->render();

Resolves: #100543
Releases: main
Change-Id: Ife55cbde49e626fea916cfb6e6af1134e121ae2f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78551


Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
parent 89df2d8f
Branches
Tags
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