Members (properties, methods, constants) become private when they are declared in the class itself, no parent class or interface declares them, no ancestor in packages/ uses them and the class has no subclass in packages/: 115 members in 36 files. Extbase domain objects keep protected properties, AbstractDomainObject sets them from the parent class. With the properties private, Rector's constructor promotion now also applies to the controllers and services that still assigned their dependencies by hand (26 files). Checked locally: frontend crawl (~1,900 URLs) and the backchannel APIs render the same as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace EP\EpTheme\ViewHelpers;
|
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
use TYPO3\CMS\Extbase\Service\ImageService;
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
|
|
|
|
class IconViewHelper extends AbstractTagBasedViewHelper
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
#[\Override]
|
|
protected $tagName = 'svg';
|
|
|
|
public function initializeArguments()
|
|
{
|
|
parent::initializeArguments();
|
|
$this->registerArgument('icon', 'string', 'Icon name', true);
|
|
}
|
|
|
|
public function render(): string
|
|
{
|
|
$imageService = self::getImageService();
|
|
$sprite = $imageService->getImage('EXT:ep_theme/Resources/Public/images/icons_sprite.svg', null, false);
|
|
$imageUrl = $sprite->getPublicUrl();
|
|
|
|
$content = sprintf('<use href="%s#icon-%s"></use>', $imageUrl, $this->arguments['icon']);
|
|
$this->tag->setContent($content);
|
|
$this->tag->addAttributes(['aria-hidden' => 'true']);
|
|
|
|
return $this->tag->render();
|
|
}
|
|
|
|
private static function getImageService()
|
|
{
|
|
return GeneralUtility::makeInstance(ImageService::class);
|
|
}
|
|
}
|