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
+111
View File
@@ -0,0 +1,111 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\DataHandling\TableColumnType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* A single field definition containing the basic information for a field
*/
abstract readonly class AbstractFieldType implements FieldTypeInterface
{
public function __construct(
protected string $name,
protected array $configuration,
) {}
public static function __set_state(array $state): self
{
/** @phpstan-ignore-next-line Usage is safe because state is exported by PHP var_export() from the static instance */
return new static(...$state);
}
abstract public function getType(): string;
public function getName(): string
{
return $this->name;
}
public function getLabel(): string
{
return (string)($this->configuration['label'] ?? '');
}
public function getDescription(): string
{
return (string)($this->configuration['description'] ?? '');
}
public function supportsAccessControl(): bool
{
return (bool)($this->configuration['exclude'] ?? false);
}
public function isRequired(): bool
{
return (bool)($this->configuration['required'] ?? false);
}
public function isNullable(): bool
{
return (bool)($this->configuration['nullable'] ?? false);
}
abstract public function isSearchable(): bool;
public function getDefaultValue(): mixed
{
return $this->configuration['default'] ?? null;
}
public function hasDefaultValue(): bool
{
return array_key_exists('default', $this->configuration);
}
public function getConfiguration(): array
{
return $this->configuration;
}
public function getTranslationBehaviour(): FieldTranslationBehaviour
{
return FieldTranslationBehaviour::tryFromFieldConfiguration($this->configuration);
}
public function getDisplayConditions(): array|string
{
return $this->configuration['displayCond'] ?? [];
}
public function isType(TableColumnType ...$tableColumnTypes): bool
{
return in_array(TableColumnType::tryFrom($this->getType()), $tableColumnTypes, true);
}
public function getSoftReferenceKeys(): array|false
{
if (!isset($this->configuration['softref'])) {
return false;
}
return GeneralUtility::trimExplode(',', $this->configuration['softref'], true);
}
}
@@ -0,0 +1,64 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Schema\RelationshipType;
final readonly class CategoryFieldType extends AbstractFieldType implements RelationalFieldTypeInterface
{
public function __construct(
protected string $name,
protected array $configuration,
private array $relations
) {}
public function getType(): string
{
return 'category';
}
public function isSearchable(): false
{
return false;
}
public function getTreeConfiguration(): array
{
return $this->configuration['treeConfig'] ?? [];
}
public function getRelations(): array
{
return $this->relations;
}
public function getRelationshipType(): RelationshipType
{
return RelationshipType::fromTcaConfiguration($this->configuration);
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class CheckboxFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'check';
}
public function isSearchable(): false
{
return false;
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+41
View File
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class ColorFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'color';
}
public function supportsOpacity(): bool
{
return (bool)($this->configuration['opacity'] ?? false);
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+36
View File
@@ -0,0 +1,36 @@
<?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\Schema\Field;
final readonly class CountryFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'country';
}
public function isSearchable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,76 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
final readonly class DateTimeFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'datetime';
}
/**
* native datetime fields are nullable by default, and
* are only not-nullable if `nullable` is explicitly set to false.
*/
public function isNullable(): bool
{
if ($this->getPersistenceType() !== null) {
return $this->configuration['nullable'] ?? true;
}
return parent::isNullable();
}
public function getFormat(): string
{
$format = $this->configuration['format'] ?? null;
$persistenceType = $this->getPersistenceType();
// A native time field must not be formatted as date
if (($format === 'datetime' || $format === 'date') && $persistenceType === 'time') {
return 'timesec';
}
// A native date field must not be formatted as time
if (($format === 'time' || $format === 'timesec') && $persistenceType === 'date') {
return 'date';
}
if (in_array($format, ['datetime', 'date', 'time', 'timesec', 'datetimesec'], true)) {
return $format;
}
if ($persistenceType !== null) {
return $persistenceType === 'time' ? 'timesec' : $persistenceType;
}
return 'datetime';
}
public function isSearchable(): bool
{
return $this->getPersistenceType() === null && ($this->configuration['searchable'] ?? true);
}
public function getPersistenceType(): ?string
{
return in_array($this->configuration['dbType'] ?? null, QueryHelper::getDateTimeTypes(), true) ? $this->configuration['dbType'] : null;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+31
View File
@@ -0,0 +1,31 @@
<?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\Schema\Field;
final readonly class EmailFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'email';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
}
+71
View File
@@ -0,0 +1,71 @@
<?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\Schema\Field;
final readonly class FieldCollection implements \ArrayAccess, \IteratorAggregate, \Countable
{
public function __construct(
/**
* @var array<string, FieldTypeInterface> $fieldDefinitions
*/
private array $fieldDefinitions = []
) {}
public static function __set_state(array $state): self
{
return new self(...$state);
}
public function offsetExists(mixed $offset): bool
{
return isset($this->fieldDefinitions[$offset]);
}
public function offsetGet(mixed $offset): ?FieldTypeInterface
{
return $this->fieldDefinitions[$offset] ?? null;
}
public function offsetSet(mixed $offset, mixed $value): void
{
throw new \InvalidArgumentException('Fields cannot be set.', 1712539281);
}
public function offsetUnset(mixed $offset): void
{
throw new \InvalidArgumentException('Fields cannot be unset.', 1712539280);
}
public function getNames(): array
{
return array_keys($this->fieldDefinitions);
}
/**
* @return \Traversable|FieldTypeInterface[]
*/
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->fieldDefinitions);
}
public function count(): int
{
return count($this->fieldDefinitions);
}
}
@@ -0,0 +1,56 @@
<?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\Schema\Field;
/**
* Defines possible behaviour scenarios based on TCA settings
* - 'l10n_mode' = exclude
* - 'l10n_mode' = prefixLangTitle
* - none = field is translatable
*/
enum FieldTranslationBehaviour
{
/**
* A field can be translated -> any custom value can be set.
*/
case Translatable;
/**
* A field can be translated. A prefix is prepended on initial localization like this:
* `[Translate to <language name>:]`
*/
case PrefixLanguageTitle;
/**
* A field is excluded from the translation editing - means, it always has the same value
* as the default translation
*/
case Excluded;
public static function tryFromFieldConfiguration(array $fieldConfiguration): self
{
$l10nMode = $fieldConfiguration['l10n_mode'] ?? null;
if ($l10nMode === 'exclude') {
return self::Excluded;
}
if ($l10nMode === 'prefixLangTitle') {
return self::PrefixLanguageTitle;
}
return self::Translatable;
}
}
@@ -0,0 +1,42 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\DataHandling\TableColumnType;
/**
* Interface for a Schema Field.
*/
interface FieldTypeInterface
{
public function getType(): string;
public function isType(TableColumnType ...$columnType): bool;
public function getName(): string;
public function getLabel(): string;
public function supportsAccessControl(): bool;
public function isRequired(): bool;
public function isNullable(): bool;
public function isSearchable(): bool;
public function getDisplayConditions(): array|string;
public function getDefaultValue(): mixed;
public function hasDefaultValue(): bool;
public function getTranslationBehaviour(): FieldTranslationBehaviour;
public function getConfiguration(): array;
public function getSoftReferenceKeys(): array|false;
public static function __set_state(array $state): FieldTypeInterface;
}
+83
View File
@@ -0,0 +1,83 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Schema\RelationshipType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* This is a field to a "file" (which is very similar to "inline") but with a hard-coded
* selection to sys_file_reference.
*/
final readonly class FileFieldType extends AbstractFieldType implements RelationalFieldTypeInterface
{
public function __construct(
protected string $name,
protected array $configuration,
private array $relations,
) {}
public function getType(): string
{
return 'file';
}
public function getAllowedFileExtensions(): array
{
return is_array($this->configuration['allowed'] ?? null)
? $this->configuration['allowed']
: GeneralUtility::trimExplode(',', $this->configuration['allowed'] ?? '', true);
}
public function getDisallowedFileExtensions(): array
{
return is_array($this->configuration['disallowed'] ?? null)
? $this->configuration['disallowed']
: GeneralUtility::trimExplode(',', $this->configuration['disallowed'] ?? '', true);
}
public function getRelations(): array
{
return $this->relations;
}
public function isSearchable(): false
{
return false;
}
public function getRelationshipType(): RelationshipType
{
return RelationshipType::fromTcaConfiguration($this->configuration);
}
public function isNullable(): false
{
return false;
}
public function hasDefaultValue(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,50 @@
<?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\Schema\Field;
final readonly class FlexFormFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'flex';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function getDataStructure(): string
{
if (!isset($this->configuration['ds'])) {
return '';
}
return is_string($this->configuration['ds']) ? $this->configuration['ds'] : '';
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+45
View File
@@ -0,0 +1,45 @@
<?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\Schema\Field;
final readonly class FolderFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'folder';
}
public function isSearchable(): false
{
return false;
}
public function isNullable(): false
{
return false;
}
public function hasDefaultValue(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+59
View File
@@ -0,0 +1,59 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Schema\RelationshipType;
final readonly class GroupFieldType extends AbstractFieldType implements RelationalFieldTypeInterface
{
public function __construct(
protected string $name,
protected array $configuration,
private array $relations,
) {}
public function getType(): string
{
return 'group';
}
public function isNullable(): false
{
return false;
}
public function getRelations(): array
{
return $this->relations;
}
public function getRelationshipType(): RelationshipType
{
return RelationshipType::fromTcaConfiguration($this->configuration);
}
public function isSearchable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,45 @@
<?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\Schema\Field;
final readonly class ImageManipulationFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'imageManipulation';
}
public function isSearchable(): false
{
return false;
}
public function isNullable(): false
{
return false;
}
public function hasDefaultValue(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+72
View File
@@ -0,0 +1,72 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Schema\RelationshipType;
/**
* This is an "inline" reference field - the "parent" field to a child table / field.
*/
final readonly class InlineFieldType extends AbstractFieldType implements RelationalFieldTypeInterface
{
public function __construct(
protected string $name,
protected array $configuration,
private array $relations
) {}
public function getType(): string
{
return 'inline';
}
public function isSearchable(): false
{
return false;
}
public function getRelations(): array
{
return $this->relations;
}
public function getRelationshipType(): RelationshipType
{
return RelationshipType::fromTcaConfiguration($this->configuration);
}
public function isMovingChildrenEnabled(): bool
{
return (bool)($this->configuration['behaviour']['disableMovingChildrenWithParent'] ?? false) === false;
}
public function isNullable(): false
{
return false;
}
public function hasDefaultValue(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+31
View File
@@ -0,0 +1,31 @@
<?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\Schema\Field;
final readonly class InputFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'input';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
}
+41
View File
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class JsonFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'json';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,46 @@
<?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\Schema\Field;
final readonly class LanguageFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'language';
}
public function isSearchable(): false
{
return false;
}
public function isNullable(): false
{
return false;
}
public function hasDefaultValue(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,46 @@
<?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\Schema\Field;
final readonly class LanguageTagFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'language_tag';
}
public function isSearchable(): true
{
return true;
}
public function isNullable(): true
{
return true;
}
public function hasDefaultValue(): true
{
return true;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+36
View File
@@ -0,0 +1,36 @@
<?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\Schema\Field;
final readonly class LinkFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'link';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function getAllowedLinkTypes(): array
{
return $this->configuration['allowedTypes'] ?? ['*'];
}
}
+48
View File
@@ -0,0 +1,48 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Schema\FieldFormat;
final readonly class NoneFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'none';
}
public function isSearchable(): false
{
return false;
}
public function getFormat(): FieldFormat
{
return FieldFormat::fromTcaConfiguration($this->configuration);
}
public function hasDefaultValue(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+41
View File
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class NumberFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'number';
}
public function isSearchable(): bool
{
return $this->getFormat() === 'integer';
}
public function getFormat(): string
{
return $this->configuration['format'] ?? '';
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,36 @@
<?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\Schema\Field;
final readonly class PassthroughFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'passthrough';
}
public function isSearchable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class PasswordFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'password';
}
public function isSearchable(): false
{
return false;
}
public function isHashed(): bool
{
return $this->configuration['hashed'] ?? true;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+41
View File
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class RadioFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'radio';
}
public function isSearchable(): false
{
return false;
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -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\Schema\Field;
use TYPO3\CMS\Core\Schema\ActiveRelation;
use TYPO3\CMS\Core\Schema\RelationshipType;
/**
* Interface for a schema field that has a relation to somewhere else.
*/
interface RelationalFieldTypeInterface
{
/**
* @return ActiveRelation[]
*/
public function getRelations(): array;
public function getRelationshipType(): RelationshipType;
}
@@ -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\Schema\Field;
use TYPO3\CMS\Core\Schema\RelationshipType;
/**
* This is a select type with a relation to some other schema.
*/
final readonly class SelectRelationFieldType extends AbstractFieldType implements RelationalFieldTypeInterface
{
public function __construct(
protected string $name,
protected array $configuration,
private array $relations,
) {}
public function getType(): string
{
return 'select';
}
public function getRelations(): array
{
return $this->relations;
}
public function getRelationshipType(): RelationshipType
{
return RelationshipType::fromTcaConfiguration($this->configuration);
}
public function isSearchable(): false
{
return false;
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+60
View File
@@ -0,0 +1,60 @@
<?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\Schema\Field;
final readonly class SlugFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'slug';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function getGeneratorOption(string $optionName): array|string|bool|null
{
return $this->configuration['generatorOptions'][$optionName] ?? null;
}
public function getGeneratorOptions(): array
{
return is_array($this->configuration['generatorOptions']) ? $this->configuration['generatorOptions'] : [];
}
public function hasDefaultValue(): true
{
return true;
}
public function getDefaultValue(): string
{
return '';
}
public function isNullable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
@@ -0,0 +1,52 @@
<?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\Schema\Field;
use TYPO3\CMS\Core\Schema\Struct\SelectItem;
/**
* This is a select type without any MM or foreign table logic.
*/
final readonly class StaticSelectFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'select';
}
public function isSearchable(): false
{
return false;
}
/**
* @return SelectItem[]
*/
public function getItems(): array
{
return is_array($this->configuration['items'] ?? false) ? array_map(
static fn($item): SelectItem => SelectItem::fromTcaItemArray($item),
$this->configuration['items']
) : [];
}
public function isNullable(): false
{
return false;
}
}
@@ -0,0 +1,41 @@
<?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\Schema\Field;
/**
* This is used for system-internal fields that haven't been defined in the "columns"
* but need a representation in some areas such as "label_alt".
* @internal This is an experimental implementation.
*/
final readonly class SystemInternalFieldType extends AbstractFieldType
{
public function getType(): string
{
return '';
}
public function isSearchable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+36
View File
@@ -0,0 +1,36 @@
<?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\Schema\Field;
final readonly class TextFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'text';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function isRichText(): bool
{
return $this->configuration['enableRichtext'] ?? false;
}
}
+41
View File
@@ -0,0 +1,41 @@
<?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\Schema\Field;
final readonly class UserFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'user';
}
public function getRenderType(): string
{
return $this->configuration['renderType'] ?? '';
}
public function isSearchable(): false
{
return false;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}
+56
View File
@@ -0,0 +1,56 @@
<?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\Schema\Field;
final readonly class UuidFieldType extends AbstractFieldType
{
public function getType(): string
{
return 'uuid';
}
public function isSearchable(): bool
{
return (bool)($this->configuration['searchable'] ?? true);
}
public function getVersion(): int
{
return in_array($this->configuration['version'] ?? 0, [4, 6, 7], true) ? $this->configuration['version'] : 4;
}
public function isNullable(): false
{
return false;
}
public function getDefaultValue(): string
{
return '';
}
public function hasDefaultValue(): true
{
return true;
}
public function getSoftReferenceKeys(): false
{
return false;
}
}