繁体   English   中英

TYPO3 TCA类型在FLUID中选择static_info_tables吗?

[英]TYPO3 TCA type select static_info_tables in FLUID?

我使用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选择表单找到了此示例,但是我需要正确的“国家”-名称而不是表单选择器。 https://docs.typo3.org/typo3cms/extensions/static_info_tables/ExtbaseDomainModel/UsingTheModel/AddingACountrySelectFieldToAForm/Index.html

我认为,我不需要“字符串”。

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

感谢帮助! 塞巴斯蒂安

您最可能想做的是在您的域模型中建立适当的关系。 您已经在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();

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM