Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation: #104304 - BackendUtility::getTcaFieldConfiguration #4335

Open
simonschaufi opened this issue Oct 15, 2024 · 0 comments
Open

Deprecation: #104304 - BackendUtility::getTcaFieldConfiguration #4335

simonschaufi opened this issue Oct 15, 2024 · 0 comments

Comments

@simonschaufi
Copy link
Collaborator

Deprecation: #104304 - BackendUtility::getTcaFieldConfiguration

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.3/Deprecation-104304-BackendUtilitygetTcaFieldConfiguration.html

Deprecation: #104304 - BackendUtility::getTcaFieldConfiguration

See 104304

Description

The method
\TYPO3\CMS\Backend\Utility\BackendUtility::getTcaFieldConfiguration
was introduced back in 2010 to add a simple abstraction to access "TCA"
definitions of a field.

However, apart from the set up that it is not part of a flexible API
without knowing the context, it was used seldom in TYPO3 Core.

The method has now been deprecated, as one could and can easily write
the same PHP code with $GLOBALS['TCA'] in mind already (which the
TYPO3 Core already did in several other places).

Now that Schema API was introduced, the last parts have been migrated to
use the new API.

Impact

Calling the PHP method BackendUtility::getTcaFieldConfiguration will
trigger a PHP deprecation warning.

Affected installations

TYPO3 installations with custom extensions using this method.

Migration

Either access $GLOBALS['TCA'] directly (in order to support TYPO3 v12
and TYPO3 v13), or migrate to the new Schema API:

public function __construct(
    private readonly TcaSchemaFactory $tcaSchemaFactory
) {}

private function getFieldConfiguration(string $table, string $fieldName): array
{
    return $this->tcaSchemaFactory
        ->get($table)
        ->getField($fieldName)
        ->getConfiguration();
}

PHP-API, TCA, FullyScanned, ext:backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant