2

在我的 TCA 配置中,我有以下代码:

'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'
    ),
),

我添加了'eval' => 'required'(最后一行),但图像仍然不是必需的。

'eval' => 'required'在文本作品等其他元素上:

'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'
    ),
),

最后一个问题:如何制作所需的图像?

4

2 回答 2

7

设置minitems为 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

于 2013-09-27T09:29:01.307 回答
2

根据TCA ref制作所需的groupselect类型字段,您需要配置'minitems' => 1您还可以设置maxitemsif ypu 要设置图像计数的上限。

于 2013-09-27T09:30:11.280 回答