TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:00 +02:00
commit f9941541b7
1178 changed files with 135377 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
<?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\Backend\Toolbar;
/**
* Enum with the severities of the SystemInformation toolbar menu
*/
enum InformationStatus: string
{
case NOTICE = '';
case INFO = 'info';
case OK = 'success';
case WARNING = 'warning';
case ERROR = 'danger';
/**
* Check if the given status is greater than this status instance
*/
public function isGreaterThan(InformationStatus $status): bool
{
return $this->getOrderRepresentation($this) > $this->getOrderRepresentation($status);
}
private function getOrderRepresentation(InformationStatus $status): int
{
return match ($status) {
self::NOTICE => -2,
self::INFO => -1,
self::OK => 0,
self::WARNING => 1,
self::ERROR => 2,
};
}
}
@@ -0,0 +1,29 @@
<?php
/*
* 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\Backend\Toolbar;
use Psr\Http\Message\ServerRequestInterface;
/**
* Interface for toolbar items that need the ServerRequestInterface Request.
* The setter is called immediately after class instantiation.
* Useful for toolbar items that depend on a request, for instance when dealing
* with views based on BackendViewFactory.
*/
interface RequestAwareToolbarItemInterface
{
public function setRequest(ServerRequestInterface $request): void;
}
+77
View File
@@ -0,0 +1,77 @@
<?php
/*
* 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\Backend\Toolbar;
/**
* Interface for classes which extend the backend by adding items to the top toolbar
*/
interface ToolbarItemInterface
{
/**
* Checks whether the user has access to this toolbar item
* @TODO: Split into two methods a permission method and a "hasContent" or similar
*
* @return bool TRUE if user has access, FALSE if not
*/
public function checkAccess();
/**
* Render "item" part of this toolbar
*
* @return string Toolbar item HTML
*/
public function getItem();
/**
* TRUE if this toolbar item has a collapsible drop down
*
* @return bool
*/
public function hasDropDown();
/**
* Render "drop down" part of this toolbar
*
* @return string Drop down HTML
*/
public function getDropDown();
/**
* Returns an array with additional attributes added to containing <li> tag of the item.
*
* Typical usages are additional css classes and data-* attributes, classes may be merged
* with other classes needed by the framework. Do NOT set an id attribute here.
*
* array(
* 'class' => 'my-class',
* 'data-foo' => '42',
* )
*
* @return array List item HTML attributes
*/
public function getAdditionalAttributes();
/**
* Returns an integer between 0 and 100 to determine
* the position of this item relative to others
*
* By default, extensions should return 50 to be sorted between main core
* items and other items that should be on the very right.
*
* @return int 0 .. 100
*/
public function getIndex();
}
+58
View File
@@ -0,0 +1,58 @@
<?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\Backend\Toolbar;
/**
* Registry class for toolbar items
* @internal
*/
class ToolbarItemsRegistry
{
protected array $toolbarItems = [];
public function __construct(iterable $toolbarItems)
{
foreach ($toolbarItems as $toolbarItem) {
if ($toolbarItem instanceof ToolbarItemInterface) {
$index = (int)$toolbarItem->getIndex();
if ($index < 0 || $index > 100) {
throw new \RuntimeException(
'getIndex() must return an integer between 0 and 100',
1415968498
);
}
// Find next free position in array
while (isset($this->toolbarItems[$index])) {
$index++;
}
$this->toolbarItems[$index] = $toolbarItem;
}
}
ksort($this->toolbarItems);
}
/**
* Get all registered toolbarItems
*
* @return ToolbarItemInterface[]
*/
public function getToolbarItems(): array
{
return $this->toolbarItems;
}
}