Markus Dübbert
Markus Dübbert

Reputation: 213

TCA how to set image description or alternative required

Is there a possibility to set the description of assets required?

The number of files i can detedermine with:

'assets' =>

              [
                'config' => [
                    'minitems' => 1,
                    'maxitems' => 1,
                ],
            ],

but how to set the description, title or alternative of the image required?

Upvotes: 1

Views: 977

Answers (2)

René Pflamm
René Pflamm

Reputation: 3354

As these fields belongs to sys_file_reference, the only way is to marking all sys_file_references this fields as required:

$GLOBALS['TCA']['sys_file_reference']['columns']['description']['config']['eval'] = 'required';

Upvotes: 1

Paul Beck
Paul Beck

Reputation: 2683

The assets field is an inline relation to "sys_file_reference". As you overrode the assets configuration of pages / tt_content you can also change the field configuration of sys_file_reference adding 'eval' => 'required' to those fields configuration. The problem: Those fields got a checkbox about the heredity of description, title and so on from the filelist. So maybe the field is filled in the meta-data in the filellist but not in the inline element which caused an validation error for me in TYPO3 6 LTS. Maybe TYPO3 7 or 8 LTS can handle "required" for those field already but I don't have time to test it right now.

Upvotes: 1

Related Questions