【问题标题】:Make imagefield required in extbase/fluid在 extbase/fluid 中设置所需的 imagefield
【发布时间】:2013-09-27 08:04:07
【问题描述】:

在我的 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'
    ),
),

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

【问题讨论】:

    标签: typo3 fluid extbase


    【解决方案1】:

    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

    【讨论】:

      【解决方案2】:

      根据TCA ref制作groupselect类型字段需要你需要配置'minitems' => 1你也可以设置maxitems如果你想设置图像计数的上限。

      【讨论】:

        猜你喜欢
        • 2017-06-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-16
        • 1970-01-01
        相关资源
        最近更新 更多