【问题标题】:TYPO3 TCA type select static_info_tables in FLUID?TYPO3 TCA 类型在 FLUID 中选择 static_info_tables?
【发布时间】:2016-02-23 09:38:28
【问题描述】:

我用于 TYPO3 TCA 后端国家选择器、类型选择和 EXT:static_info_tables // static_info_tables_de

它在后端完美运行。我这里有一个国家-选择:

'land' => array(
    'exclude' => 1,
    'label' => 'Land',
    'displayCond' => 'EXT:static_info_tables_de:LOADED:true',
    'config' => array(
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => array(
            array('', 0)
        ),
        'foreign_table' => 'static_countries',
        'allowNonIdValues' => TRUE,
        'foreign_table_where' => 'ORDER BY static_countries.cn_short_de',
        'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateCountriesSelector',
        //'itemsProcFunc_config' => array(
        //    'indexField' => 'cn_short_de',
        //),
        'size' => 1,
        'minitems' => 0,
        'maxitems' => 1,
        'default' => '54', // Default Germany value="54"
        'eval' => 'required'
    )
),

FE 调试输出为 = land => '54' (2 chars) 但是,我不知道如何更改 Country-Name 中的 ID?

这是型号 - 代码:

/**
 * Land
 *
 * @var string
 *
 */
protected $land = '';

/**
 * Returns the land
 *
 * @return string $land
 */
public function getLand() {
    return $this->land;
}

/**
 * Sets the land
 *
 * @param string $land
 * @return void
 */

public function setLand($land) {
    $this->land = $land;
}

我为 FE Select-Form 找到了这个示例,但我需要正确的“Country”-Name 而不是 FORM-Selector。 https://docs.typo3.org/typo3cms/extensions/static_info_tables/ExtbaseDomainModel/UsingTheModel/AddingACountrySelectFieldToAForm/Index.html

我想,我不需要“字符串”.. 我需要这个:

@param \SJBR\StaticInfoTables\Domain\Repository\CountryRepository $land

感谢您的帮助! 塞巴斯蒂安

【问题讨论】:

  • 你在使用 extbase 吗?

标签: typo3 fluid typo3-7.6.x


【解决方案1】:

您最可能想要做的是在您的领域模型中建立适当的关系。您已经在 TCA 中设置了关系,因此请调整您的模型:

/**
 * @var \SJBR\StaticInfoTables\Domain\Model\Country
 */
protected $land = '';

/**
 * @return \SJBR\StaticInfoTables\Domain\Model\Country $land
 */
public function getLand() {
    return $this->land;
}

/**
 * @param \SJBR\StaticInfoTables\Domain\Model\Country $land
 * @return void
 */  
public function setLand(\SJBR\StaticInfoTables\Domain\Model\Country $land) {
    $this->land = $land;
}

静态信息表扩展已经告诉 extbase 如何将数据库表映射到\SJBR\StaticInfoTables\Domain\Model\Country 模型。 因此,在此更改之后,您应该能够获取国家/地区的名称。

$model->getLand()->getOfficialNameLocal();

您可以检查模型以了解您现在可以使用哪些吸气剂。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-06
    • 2018-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多