1
votes

In my TCA Configuration I have the following code:

'image' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xml:tx_myext_domain_model_modelname.image',
    'config' => array(
        'type' => 'group',
        'internal_type' => 'file',
        'uploadfolder' => 'uploads/tx_myext',
        'show_thumbs' => 1,
        'size' => 5,
        'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
        'disallowed' => '',
        'eval' => 'required'
    ),
),

I added 'eval' => 'required'(last line) but the image is still not required.

On other elements like text 'eval' => 'required' works:

'homepage' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xml:tx_myext_domain_model_modelname.homepage',
    'config' => array(
        'type' => 'input',
        'size' => 30,
        'eval' => 'trim,required'
    ),
),

Final question: How to make the image required?

2

2 Answers

6
votes

Set minitems to 1.

'image' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:next_itrocksfirmen/Resources/Private/Language/locallang_db.xml:tx_myext_domain_model_modelname.image',
    'config' => array(
        'type' => 'group',
        'internal_type' => 'file',
        'uploadfolder' => 'uploads/tx_myext',
        'show_thumbs' => 1,
        'size' => 5,
        'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
        'disallowed' => '',
        'minitems' => 1
    ),
),

http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Group/Index.html

2
votes

According to TCA ref to make a group or select type field required you need to configure 'minitems' => 1 you can also set the maxitems if ypu want to set upper limit for image count.