【问题标题】:TYPO3: How to extend sys_file_collection?TYPO3:如何扩展 sys_file_collection?
【发布时间】:2018-11-03 08:32:04
【问题描述】:

我想向 TYPO3 文件集合添加其他字段。
我尝试使用this Documentation 并将我的字段添加到 TCA 和 DB。 只要我只在后端,它就可以正常工作。但在 Fluid 中,我无法访问我的新闻字段。
下一步是我尝试扩展模型以使我的字段具有 getter 和 setter,并将 extbase 设置为使用我的模型类。但是 TYPO3 忽略了它。

StaticFileCollection.php

class StaticFileCollection extends \TYPO3\CMS\Core\Resource\Collection\StaticFileCollection
{
/**
 * Subheader
 *
 * @var string
 */
protected $subheader = '';

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

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

setup.txt

config.tx_extbase {
objects {
    TYPO3\CMS\Core\Resource\Collection\StaticFileCollection {
        className = MyNamespace\MyExtension\Domain\Model\StaticFileCollection
    }
}
}

我错过了什么?

【问题讨论】:

    标签: typo3 fluid typo3-8.x


    【解决方案1】:

    您的设置应如下所示:

    config.tx_extbase{
        objects {
            TYPO3\CMS\Extbase\Domain\Model\Category.className = VENDOR\Extension\Domain\Model\Category
        }
        persistence.classes {
            VENDOR\Extension\Domain\Model\Category {
                mapping {
                    tableName = sys_category
                }
            }
        }
    }
    

    【讨论】:

    • 不幸的是,这对 StaticFileCollection 不起作用。 ExtensionBuilder 创建了该 TS,但它也说明了以下内容: 表“sys_file_collection”的配置与 extbase 不兼容。如果要映射到这个表,必须自己配置
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-23
    • 1970-01-01
    • 2018-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多