TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:09 +02:00
commit af8cc155b5
6818 changed files with 642608 additions and 0 deletions
@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\ViewHelpers;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* ViewHelper to display an icon for a record.
*
* ```
* <core:iconForRecord table="tt_content" row="{record}" />
* ```
*
* @see https://docs.typo3.org/permalink/t3viewhelper:typo3-core-iconforrecord
*/
final class IconForRecordViewHelper extends AbstractViewHelper
{
/**
* ViewHelper returns HTML, thus we need to disable output escaping
*
* @var bool
*/
protected $escapeOutput = false;
public function __construct(
private readonly IconFactory $iconFactory
) {}
public function initializeArguments(): void
{
$this->registerArgument('table', 'string', 'the table for the record icon', true);
$this->registerArgument('row', 'array', 'the record row', true);
$this->registerArgument('size', 'string', 'the icon size', false, IconSize::SMALL->value);
$this->registerArgument('alternativeMarkupIdentifier', 'string', 'alternative markup identifier');
}
public function render(): string
{
$table = $this->arguments['table'];
$size = IconSize::from($this->arguments['size']);
$row = $this->arguments['row'];
$alternativeMarkupIdentifier = $this->arguments['alternativeMarkupIdentifier'];
return $this->iconFactory->getIconForRecord($table, $row, $size)->render($alternativeMarkupIdentifier);
}
}
@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\ViewHelpers;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3\CMS\Core\Resource\ResourceInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* ViewHelper to displays an icon for a FAL resource (file or folder means a `TYPO3\CMS\Core\Resource\ResourceInterface`).
*
* ```
* <core:iconForResource resource="{file.resource}" />
* ```
*
* @see https://docs.typo3.org/permalink/t3viewhelper:typo3-core-iconforresource
* @see \TYPO3\CMS\Core\Resource\ResourceInterface
*/
final class IconForResourceViewHelper extends AbstractViewHelper
{
/**
* ViewHelper returns HTML, thus we need to disable output escaping
*
* @var bool
*/
protected $escapeOutput = false;
public function __construct(
private readonly IconFactory $iconFactory
) {}
public function initializeArguments(): void
{
$this->registerArgument('resource', ResourceInterface::class, 'Resource', true);
$this->registerArgument('size', 'string', 'The icon size', false, IconSize::SMALL);
$this->registerArgument('overlay', 'string', 'Overlay identifier', false, null);
$this->registerArgument('options', 'array', 'An associative array with additional options', false, []);
$this->registerArgument('alternativeMarkupIdentifier', 'string', 'Alternative markup identifier');
}
public function render(): string
{
$resource = $this->arguments['resource'];
if (!($resource instanceof ResourceInterface)) {
return '';
}
$size = $this->arguments['size'];
$overlay = $this->arguments['overlay'];
return $this->iconFactory->getIconForResource($resource, $size, $overlay, $this->arguments['options'])->render($this->arguments['alternativeMarkupIdentifier']);
}
}
+73
View File
@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\ViewHelpers;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3\CMS\Core\Imaging\IconState;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* ViewHelper to display an icon identified by its icon identifier.
*
* ```
* <core:icon title="Open actions menu" identifier="actions-menu" />
* ```
*
* @see https://docs.typo3.org/permalink/t3viewhelper:typo3-core-icon
*/
final class IconViewHelper extends AbstractViewHelper
{
/**
* ViewHelper returns HTML, thus we need to disable output escaping
*
* @var bool
*/
protected $escapeOutput = false;
public function __construct(
private readonly IconFactory $iconFactory
) {}
public function initializeArguments(): void
{
$this->registerArgument('identifier', 'string', 'Identifier of the icon as registered in the Icon Registry.', true);
$this->registerArgument('size', 'string', 'Desired size of the icon. All values of the IconSize enum are allowed, these are: "small", "default", "medium", "large" and "mega".', false, IconSize::SMALL->value);
$this->registerArgument('overlay', 'string', 'Identifier of an overlay icon as registered in the Icon Registry.');
$this->registerArgument('state', 'string', 'Sets the state of the icon. All values of the Icons.states enum are allowed, these are: "default" and "disabled".', false, IconState::STATE_DEFAULT->value);
$this->registerArgument('alternativeMarkupIdentifier', 'string', 'Alternative icon identifier. Takes precedence over the identifier if supported by the IconProvider.');
$this->registerArgument('title', 'string', 'Title for the icon');
}
/**
* Prints icon html for $identifier key
*/
public function render(): string
{
$identifier = $this->arguments['identifier'];
$size = IconSize::from($this->arguments['size']);
$overlay = $this->arguments['overlay'];
$state = IconState::tryFrom($this->arguments['state']);
$alternativeMarkupIdentifier = $this->arguments['alternativeMarkupIdentifier'];
$icon = $this->iconFactory->getIcon($identifier, $size, $overlay, $state);
if ($this->arguments['title'] ?? false) {
$icon->setTitle($this->arguments['title']);
}
return $icon->render($alternativeMarkupIdentifier);
}
}
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\ViewHelpers;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\SystemResource\Publishing\SystemResourcePublisherInterface;
use TYPO3\CMS\Core\SystemResource\Publishing\UriGenerationOptions;
use TYPO3\CMS\Core\SystemResource\SystemResourceFactory;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* ViewHelper to normalize a path that uses EXT: syntax or an absolute URL to an absolute web path.
*
* ```
* <core:normalizedUrl pathOrUrl="https://foo.bar/img.jpg" />
* <core:normalizedUrl pathOrUrl="EXT:core/Resources/Public/Images/typo3_black.svg" />
* ```
*
* @see https://docs.typo3.org/permalink/t3viewhelper:typo3-core-normalizedurl
* @internal
*/
final class NormalizedUrlViewHelper extends AbstractViewHelper
{
public function __construct(
private readonly SystemResourceFactory $systemResourceFactory,
private readonly SystemResourcePublisherInterface $resourcePublisher,
) {}
public function initializeArguments(): void
{
$this->registerArgument('pathOrUrl', 'string', 'Absolute path to file using EXT: syntax or URL.');
}
/**
* Output what is given as URL or extension relative path as absolute URL
*/
public function render(): string
{
$pathOrUrl = $this->renderChildren();
$resource = $this->systemResourceFactory->createPublicResource($pathOrUrl);
return (string)$this->resourcePublisher->generateUri(
$resource,
$this->renderingContext->hasAttribute(ServerRequestInterface::class) ? $this->renderingContext->getAttribute(ServerRequestInterface::class) : null,
new UriGenerationOptions(absoluteUri: true),
);
}
/**
* Explicitly set argument name to be used as content.
*/
public function getContentArgumentName(): string
{
return 'pathOrUrl';
}
}