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,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\Messaging\Renderer;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3\CMS\Core\Messaging\FlashMessage;
/**
* A class representing a bootstrap flash messages.
* This class renders flash messages as markup, based on the
* bootstrap HTML/CSS framework. It is used in backend context.
* The created output contains all classes which are required for
* the TYPO3 backend. Any kind of message contains also a nice icon.
*/
#[Autoconfigure(public: true)]
readonly class BootstrapRenderer implements FlashMessageRendererInterface
{
public function __construct(
private IconFactory $iconFactory,
) {}
/**
* Gets the message rendered as clean and secure markup
*
* @param FlashMessage[] $flashMessages
* @return string Representation of the flash message
*/
public function render(array $flashMessages): string
{
$markup = [];
$markup[] = '<div class="typo3-messages">';
foreach ($flashMessages as $flashMessage) {
$messageTitle = $flashMessage->getTitle();
$markup[] = '<div class="alert alert-' . htmlspecialchars($flashMessage->getSeverity()->getCssClass()) . '">';
$markup[] = ' <div class="alert-inner">';
$markup[] = ' <div class="alert-icon">';
$markup[] = ' <span class="icon-emphasized">';
$markup[] = $this->iconFactory->getIcon($flashMessage->getSeverity()->getIconIdentifier(), IconSize::SMALL)->render();
$markup[] = ' </span>';
$markup[] = ' </div>';
$markup[] = ' <div class="alert-content">';
if ($messageTitle !== '') {
$markup[] = ' <div class="alert-title">' . htmlspecialchars($messageTitle) . '</div>';
}
$markup[] = ' <p class="alert-message">' . htmlspecialchars($flashMessage->getMessage()) . '</p>';
$markup[] = ' </div>';
$markup[] = ' </div>';
$markup[] = '</div>';
}
$markup[] = '</div>';
return implode('', $markup);
}
}
@@ -0,0 +1,34 @@
<?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\Messaging\Renderer;
use TYPO3\CMS\Core\Messaging\FlashMessage;
/**
* Interface must be implemented by all flash message renderer classes
*/
interface FlashMessageRendererInterface
{
/**
* Render method
*
* @param FlashMessage[] $flashMessages
* @return string Representation of the flash message
*/
public function render(array $flashMessages): string;
}
@@ -0,0 +1,54 @@
<?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\Messaging\Renderer;
use TYPO3\CMS\Core\Messaging\FlashMessage;
/**
* A class representing a html flash message as unordered markup list.
* It is used in frontend context by default.
* The created output contains css classes which can be used to style
* the output individual. Any message contains the message and an
* optional title which is rendered as <h4> tag if it is set in
* the FlashMessage object.
*/
readonly class ListRenderer implements FlashMessageRendererInterface
{
/**
* Gets the message rendered as clean and secure markup
*
* @param FlashMessage[] $flashMessages
* @return string Representation of the flash message
*/
public function render(array $flashMessages): string
{
$markup = [];
$markup[] = '<ul class="typo3-messages">';
foreach ($flashMessages as $flashMessage) {
$messageTitle = $flashMessage->getTitle();
$markup[] = '<li class="alert alert-' . htmlspecialchars($flashMessage->getSeverity()->getCssClass()) . '">';
if ($messageTitle !== '') {
$markup[] = '<h4 class="alert-title">' . htmlspecialchars($messageTitle) . '</h4>';
}
$markup[] = '<p class="alert-message">' . htmlspecialchars($flashMessage->getMessage()) . '</p>';
$markup[] = '</li>';
}
$markup[] = '</ul>';
return implode('', $markup);
}
}
@@ -0,0 +1,61 @@
<?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\Messaging\Renderer;
use TYPO3\CMS\Core\Messaging\FlashMessage;
/**
* A class representing a html flash message as plain text.
* It is used in CLI context per default.
* The created output contains at least the severity and the message
* in the following format:
* [SEVERITY] <message>
*
* Example:
* [ERROR] No record found
*
* In case the FlashMessage object contains also a title, the
* following format is used:
* [SEVERITY] <title>: <message>
*
* Example:
* [ERROR] An error occurred: No record found
*
* Multiple messages are separated by a new line (LF).
*/
readonly class PlaintextRenderer implements FlashMessageRendererInterface
{
/**
* Render method
*
* @param FlashMessage[] $flashMessages
* @return string Representation of the flash message as plain text
*/
public function render(array $flashMessages): string
{
$messages = [];
foreach ($flashMessages as $flashMessage) {
$message = $flashMessage->getMessage();
if ($flashMessage->getTitle() !== '') {
$message = $flashMessage->getTitle() . ': ' . $message;
}
$messages[] = '[' . $flashMessage->getSeverity()->name . '] ' . $message;
}
return implode(LF, $messages);
}
}