TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -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\Capability;
|
||||
|
||||
use TYPO3\CMS\Core\Schema\Field\FieldTypeInterface;
|
||||
|
||||
/**
|
||||
* Can be used for any kind of field which HAS a definition in the "columns" section of TCA.
|
||||
*
|
||||
* Examples:
|
||||
* - editLock
|
||||
* - descriptionField
|
||||
* - any kind of enableFields
|
||||
*/
|
||||
final readonly class FieldCapability implements SchemaCapabilityInterface
|
||||
{
|
||||
public function __construct(
|
||||
private FieldTypeInterface $field
|
||||
) {}
|
||||
|
||||
public function getFieldName(): string
|
||||
{
|
||||
return $this->field->getName();
|
||||
}
|
||||
|
||||
public function getField(): FieldTypeInterface
|
||||
{
|
||||
return $this->field;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getFieldName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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\Capability;
|
||||
|
||||
/**
|
||||
* Contains all information of compiling the label information of a schema.
|
||||
*/
|
||||
final readonly class LabelCapability implements SchemaCapabilityInterface
|
||||
{
|
||||
public function __construct(
|
||||
private ?string $primaryFieldName,
|
||||
/** @var string[] */
|
||||
private array $additionalFieldNames,
|
||||
private bool $alwaysRenderAdditionalFields,
|
||||
private array $configuration,
|
||||
) {}
|
||||
|
||||
public function getPrimaryFieldName(): ?string
|
||||
{
|
||||
return $this->primaryFieldName;
|
||||
}
|
||||
|
||||
public function hasPrimaryField(): bool
|
||||
{
|
||||
return $this->primaryFieldName !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAdditionalFieldNames(): array
|
||||
{
|
||||
return $this->additionalFieldNames;
|
||||
}
|
||||
|
||||
public function getAllLabelFieldNames(): array
|
||||
{
|
||||
return array_unique(array_filter(array_merge([$this->primaryFieldName], $this->additionalFieldNames)));
|
||||
}
|
||||
|
||||
public function alwaysRenderAdditionalFields(): bool
|
||||
{
|
||||
return $this->alwaysRenderAdditionalFields;
|
||||
}
|
||||
|
||||
public function getConfiguration(): array
|
||||
{
|
||||
return $this->configuration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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\Capability;
|
||||
|
||||
use TYPO3\CMS\Core\Schema\Field\FieldTypeInterface;
|
||||
use TYPO3\CMS\Core\Schema\Field\LanguageFieldType;
|
||||
use TYPO3\CMS\Core\Schema\Field\LanguageTagFieldType;
|
||||
|
||||
/**
|
||||
* Contains all information if a schema is language-aware, meaning
|
||||
* it has a "languageField", a "translationOrigPointerField", maybe a "translationSourceField"
|
||||
* and maybe a "diffSourceField".
|
||||
*/
|
||||
final readonly class LanguageAwareSchemaCapability implements SchemaCapabilityInterface
|
||||
{
|
||||
public function __construct(
|
||||
private LanguageFieldType $languageField,
|
||||
private FieldTypeInterface $originPointerField,
|
||||
private ?FieldTypeInterface $translationSourceField,
|
||||
private ?FieldTypeInterface $diffSourceField
|
||||
) {}
|
||||
|
||||
/**
|
||||
* languageField->getName() typically resolves to 'sys_language_uid'
|
||||
*/
|
||||
public function getLanguageField(): LanguageFieldType
|
||||
{
|
||||
return $this->languageField;
|
||||
}
|
||||
|
||||
public function getLanguageTagField(): LanguageTagFieldType
|
||||
{
|
||||
return new LanguageTagFieldType('language_tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* translationOriginPointerField->getName() typically resolves to 'l10n_parent' or 'l18n_parent'
|
||||
*/
|
||||
public function getTranslationOriginPointerField(): FieldTypeInterface
|
||||
{
|
||||
return $this->originPointerField;
|
||||
}
|
||||
|
||||
public function hasTranslationSourceField(): bool
|
||||
{
|
||||
return $this->translationSourceField !== null;
|
||||
}
|
||||
|
||||
public function getTranslationSourceField(): ?FieldTypeInterface
|
||||
{
|
||||
return $this->translationSourceField;
|
||||
}
|
||||
|
||||
/**
|
||||
* diffSourceField->getName() typically resolves to 'l10n_diffsource' or 'l18n_diffsource'
|
||||
*/
|
||||
public function getDiffSourceField(): ?FieldTypeInterface
|
||||
{
|
||||
return $this->diffSourceField;
|
||||
}
|
||||
|
||||
public function hasDiffSourceField(): bool
|
||||
{
|
||||
return $this->diffSourceField !== null;
|
||||
}
|
||||
}
|
||||
@@ -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\Capability;
|
||||
|
||||
/**
|
||||
* Capability to understand the flag within
|
||||
* - security.ignoreRootLevelRestriction
|
||||
*/
|
||||
final readonly class RootLevelCapability implements SchemaCapabilityInterface
|
||||
{
|
||||
public const int TYPE_ONLY_ON_PAGES = 0; // must be on a page (not pid=0)
|
||||
public const int TYPE_ONLY_ON_ROOTLEVEL = 1; // only allowed on pid=0
|
||||
public const int TYPE_BOTH = -1; // does not matter
|
||||
|
||||
public function __construct(
|
||||
private int $rootLevelType,
|
||||
private bool $ignoreRootLevelRestriction
|
||||
) {}
|
||||
|
||||
public function getRootLevelType(): int
|
||||
{
|
||||
return $this->rootLevelType;
|
||||
}
|
||||
|
||||
public function shallIgnoreRootLevelRestriction(): bool
|
||||
{
|
||||
return $this->ignoreRootLevelRestriction;
|
||||
}
|
||||
|
||||
public function canExistOnRootLevel(): bool
|
||||
{
|
||||
return $this->rootLevelType === self::TYPE_BOTH || $this->rootLevelType === self::TYPE_ONLY_ON_ROOTLEVEL;
|
||||
}
|
||||
|
||||
public function canExistOnPages(): bool
|
||||
{
|
||||
return $this->rootLevelType === self::TYPE_BOTH || $this->rootLevelType === self::TYPE_ONLY_ON_PAGES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows non-admin users to access records that on the root-level (page-id 0), thus bypassing this usual restriction.
|
||||
*/
|
||||
public function canAccessRecordsOnRootLevel(): bool
|
||||
{
|
||||
return !$this->rootLevelType || $this->ignoreRootLevelRestriction;
|
||||
}
|
||||
}
|
||||
@@ -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\Capability;
|
||||
|
||||
/**
|
||||
* Primitive capability that just contains a fixed value.
|
||||
* Examples:
|
||||
* - default_sortby
|
||||
* - versioningWS
|
||||
* - adminOnly
|
||||
* - readOnly
|
||||
* - hideAtCopy
|
||||
* - hideTable
|
||||
* - prependAtCopy
|
||||
*/
|
||||
final readonly class ScalarCapability implements SchemaCapabilityInterface
|
||||
{
|
||||
public function __construct(
|
||||
private bool|string|int|array|float|null $value = null
|
||||
) {}
|
||||
|
||||
public function getValue(): bool|string|int|array|float|null
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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\Capability;
|
||||
|
||||
/**
|
||||
* A semantic interface for any kind of capability.
|
||||
*/
|
||||
interface SchemaCapabilityInterface {}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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\Capability;
|
||||
|
||||
/**
|
||||
* Can be used for any kind of field which does NOT have
|
||||
* a definition in the "columns" section of TCA.
|
||||
*
|
||||
* -> sortBy
|
||||
* -> crdate
|
||||
* -> tstamp
|
||||
* -> delete
|
||||
*/
|
||||
final readonly class SystemInternalFieldCapability implements SchemaCapabilityInterface
|
||||
{
|
||||
public function __construct(
|
||||
private string $fieldName
|
||||
) {}
|
||||
|
||||
public function getFieldName(): string
|
||||
{
|
||||
return $this->fieldName;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getFieldName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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\Capability;
|
||||
|
||||
/**
|
||||
* Contains all capabilities that can be defined in TCA
|
||||
* and are understandable by the Schema API.
|
||||
*/
|
||||
enum TcaSchemaCapability
|
||||
{
|
||||
// TCA[ctrl][delete]
|
||||
case SoftDelete;
|
||||
|
||||
// TCA[ctrl][crdate]
|
||||
case CreatedAt;
|
||||
|
||||
// TCA[ctrl][tstamp]
|
||||
case UpdatedAt;
|
||||
|
||||
// TCA[ctrl][sortby]
|
||||
case SortByField;
|
||||
|
||||
// TCA[ctrl][default_sortby]
|
||||
case DefaultSorting;
|
||||
|
||||
// TCA[ctrl][origUid]
|
||||
case AncestorReferenceField;
|
||||
|
||||
// TCA[ctrl][editlock]
|
||||
case EditLock;
|
||||
|
||||
// TCA[ctrl][descriptionColumn]
|
||||
case InternalDescription;
|
||||
|
||||
// TCA[ctrl][language]
|
||||
case Language;
|
||||
|
||||
// TCA[ctrl][workspace]
|
||||
case Workspace;
|
||||
|
||||
// TCA[ctrl][label],TCA[ctrl][label_alt],TCA[ctrl][label_alt_force]...
|
||||
case Label;
|
||||
|
||||
// TCA[ctrl][adminOnly]
|
||||
case AccessAdminOnly;
|
||||
|
||||
// TCA[ctrl][readOnly]
|
||||
case AccessReadOnly;
|
||||
|
||||
// TCA[ctrl][hideAtCopy]
|
||||
case HideRecordsAtCopy;
|
||||
|
||||
// TCA[ctrl][hideTable]
|
||||
case HideInUi;
|
||||
|
||||
// TCA[ctrl][prependAtCopy]
|
||||
case PrependLabelTextAtCopy;
|
||||
|
||||
// TCA[ctrl][enablecolumns][disabled]
|
||||
case RestrictionDisabledField;
|
||||
|
||||
// TCA[ctrl][enablecolumns][starttime]
|
||||
case RestrictionStartTime;
|
||||
|
||||
// TCA[ctrl][enablecolumns][endtime]
|
||||
case RestrictionEndTime;
|
||||
|
||||
// TCA[ctrl][enablecolumns][fe_group]
|
||||
case RestrictionUserGroup;
|
||||
|
||||
// TCA[ctrl][extbase][enableHistoryTracking]
|
||||
case ExtbaseHistoryTracking;
|
||||
|
||||
case RestrictionRootLevel;
|
||||
|
||||
// TCA[ctrl][ignoreWebMountRestriction] inverted
|
||||
case RestrictionWebMount;
|
||||
private const SYSTEM_CAPABILITIES = [
|
||||
self::CreatedAt,
|
||||
self::UpdatedAt,
|
||||
self::RestrictionStartTime,
|
||||
self::RestrictionEndTime,
|
||||
self::SoftDelete,
|
||||
self::EditLock,
|
||||
self::RestrictionDisabledField,
|
||||
self::InternalDescription,
|
||||
self::SortByField,
|
||||
self::RestrictionUserGroup,
|
||||
];
|
||||
|
||||
public static function getSystemCapabilities(): array
|
||||
{
|
||||
return self::SYSTEM_CAPABILITIES;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user