fgtclb/file-required-attributes

Marks metadata fields required and disables file references if required fields are missing

Installs: 1 040

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 4

Type:typo3-cms-extension

v1.1.1 2024-07-30 15:03 UTC

README

What does it do?

This extension offers the ability to set metadata information as required. With required attributes, it provides the possibility to disable references having missing attributes.

If metadata is set in file reference, too, the file reference is updated.

If attribute only appears in metadata, a virtual field is added to reference, enforcing the ability to update metadata from reference. A warning, this change is made globally, is added to the field description.

Installation

composer req fgtclb/file-required-attributes

How to use

Add required field registration in TCA/Overrides/sys_file_metadata.php inside your extension:

<?php

declare(strict_types=1);

(static function (): void {
    \FGTCLB\FileRequiredAttributes\Utility\RequiredColumnsUtility::register(
        'copyright',
        [
            \TYPO3\CMS\Core\Resource\AbstractFile::FILETYPE_IMAGE,
            // ...
        ]
    );
    \FGTCLB\FileRequiredAttributes\Utility\RequiredColumnsUtility::register(
        'alternative',
        [
            \TYPO3\CMS\Core\Resource\AbstractFile::FILETYPE_IMAGE,
            // ...
        ]
    );
    \FGTCLB\FileRequiredAttributes\Utility\RequiredColumnsUtility::register(
        'title',
        [
            \TYPO3\CMS\Core\Resource\AbstractFile::FILETYPE_IMAGE,
        ]
    );
    \FGTCLB\FileRequiredAttributes\Utility\RequiredColumnsUtility::register(
        'description',
        [
            \TYPO3\CMS\Core\Resource\AbstractFile::FILETYPE_IMAGE,
        ]
    );
})();

This extension will handle all required steps by itself, you don't need to handle with TCA.