【问题标题】:TYPO3 - extending an extbase extension with new fields and using these in fluid templatesTYPO3 - 使用新字段扩展 extbase 扩展并在流体模板中使用这些
【发布时间】:2023-04-08 09:19:01
【问题描述】:

我正在尝试扩展 powermail(版本 2),以便为每个输入字段添加注释。到目前为止,我已经使用扩展构建器创建了一个新扩展,并对 ext_tables.php 进行了一些修改,该字段显示在后端。新字段称为“note”,我想我可以在流动模板 input.html 中执行类似 {field.note} 的操作,但这不起作用。我的模型包括 setter 和 getter:

类 Tx_Formnotes_Domain_Model_Powermailnotes 扩展 Tx_Extbase_DomainObject_AbstractEntity {

/**
 * note
 *
 * @var string
 */
protected $note;

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

/**
 * Sets the note
 *
 * @param string $note
 * @return void
 */
public function setNote($note) {
    $this->note = $note;
}

}

还需要什么?

信息:我正在使用 TYPO3 4.7

【问题讨论】:

    标签: fluid extbase


    【解决方案1】:

    你可以像这样映射 powermail 模型

    config.tx_extbase.persistence.classes {
    
    Tx_Formnotes_Domain_Model_Powermailnotes {
        mapping {
            tableName = powermailTableName
            columns {
                exampleMedia.mapOnProperty = media
            }
        }
    }
    }
    

    之后,您应该使用这些属性扩展您的 TCA。至少你可以为每个属性编写 setter 和 getter 并在你的流体模板中使用它们。

    【讨论】:

    • “扩展 TCA”是什么意思。除了扩展构建器已经创建的内容之外,我还需要做更多的事情吗?
    • 您必须添加映射字段才能使用 setter 或 getter 访问这些属性。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 1970-01-01
    • 1970-01-01
    • 2016-09-03
    • 2016-10-17
    • 1970-01-01
    相关资源
    最近更新 更多