- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的 ext_tables.php(由 Extension Builder 构建)中找到了这些行:
<?php
defined('TYPO3_MODE') || die('Access denied.');
call_user_func(
function()
{
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('rm_navigation', 'Configuration/TypoScript', 'Navigation');
}
);
我将 TYPO3 8 的这个迁移到 Configuration/TCA/Overrides/sys_template.php 与这些行:
<?php
defined('TYPO3_MODE') || die('Access denied.');
// Extensionregistration
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('rm_navigation', 'Configuration/TypoScript', 'Navigation');
我读到最好使用 call_user_func 函数,但他/她没有写为什么。
那么:使用 call_user_func 函数更好吗?
还有:为什么这样更好?
尤其是 TYPO3。
谢谢。
最佳答案
这种结构只有一个目的:封装。
当您在 ext_tables.php
或 ext_localconf.php
中需要一个临时变量时,您就有可能将此变量泄漏到下一个扩展名的同一文件中,该文件在您之后加载。 PHP 中的闭包作为严格范围,可防止将变量泄漏到闭包中以及将变量泄漏到周围的代码中。
这样做的原因是所有 ext_tables.php
和 ext_localconf.php
文件都连接成一个文件并存储在缓存中。这对于 TCA 和 TCA 覆盖没有问题,因为它们在构建整个数组后作为整体存储。
所以在 ext_tables.php
或 ext_localconf.php
你真的应该使用这个结构。
奖励:在 PHP 7.x 和更新版本中,这可以简化:
(function() {
// ...
})();
关于typo3 - 在(例如)tt_content.php TCA 中使用 call_user_func() 会更好吗?为什么? (TYPO3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49514481/
我需要与 TYPO3 标准相同的功能。在那里您可以选择一个链接(外部站点、内部站点、文件等) 我怎样才能做到这一点? 最佳答案 您可以在文件typo3/sysext/cms/tbl_tt_conten
我的TYPO3是11.5.26。我有一个自定义实体。我生成了TCA配置。。我需要在某个条件下更改另一个值字段的值。。例如:如果“Deadline field Date”<=TODAY,则“State”
Typo3 6.2,正在处理我的个人分机。我在这个 TCA 中使用了 flexform: 'eventdate' => array( 'exclude' => 1, 'label' =
Typo3 6.2,正在处理我的个人分机。我在这个 TCA 中使用了 flexform: 'eventdate' => array( 'exclude' => 1, 'label' =
我想根据先前提交的值更改 tca 字段配置类型。例如有两个字段 field_one 和 field_two 如下所示 'field_one' => array( 'exclude' => 0, '
我是新手 typo3 .我的一个 friend 问,我是否可以为他升级他的安装,因为我是一名开发人员。所以我检查了我是否可以做到。 我做了几个步骤从 7.6.9 升级安装至 8.7.3 .现在我在 i
我想将后端的复选框设置为默认选中。 在我的例子中,它是文件 /typo3conf/ext/news/Configuration/TCA/tx_news_domain_model_media.php 中
我想将后端的复选框设置为默认选中。 在我的例子中,它是文件 /typo3conf/ext/news/Configuration/TCA/tx_news_domain_model_media.php 中
在我的 Typo3 扩展中,我希望表列之一为“日期时间”,类型为“时间戳”,默认为“CURRENT_TIMESTAMP”。 我如何在 TCA 文件中创建它。 我在下面给出了我的代码。但这并不是创建类型
标题不言自明,但我想要的是动态默认值。 其背后的想法是从数据库中的列中获取最大的数字,然后将结果加一。此结果应保存为默认值。 让我们以这段代码为例: $GLOBALS['TCA'][$modelNam
当我尝试在 TCA 中添加名为 wizard_geo_selector 的向导时,出现“模块未注册”错误。请告诉我如何在 TCA 中正确注册向导。? 最佳答案 在 TYPO3 7.6 版中,新向导添加
我正在努力解决以下问题。 我有两个数据库表,“书籍”和“类别”。我正在通过后端 ListView 中的 Sysfolder 从“书籍”表中获取所有数据,以便对其进行编辑、排序和控制。 我想得到的是,在
服务,我正在寻找解决方案,如何删除 TYPO3 TCA 中的覆盖检查按钮。 我的 TCA 配置: 'myfield' => array( 'l10n_mode' => 'mergeIfNotB
我正在寻找在 TYPO3 后端的字段之间添加新行的方法。 这是我的 TCA 代码: 'tx_name' => array( 'label' => 'Your name'
服务,我正在寻找解决方案,如何删除 TYPO3 TCA 中的覆盖检查按钮。 我的 TCA 配置: 'myfield' => array( 'l10n_mode' => 'mergeIfNotB
我正在寻找在 TYPO3 后端的字段之间添加新行的方法。 这是我的 TCA 代码: 'tx_name' => array( 'label' => 'Your name'
如果通过后端保存对象,我想操作一些值并执行自定义函数。我通过我的谷歌搜索发现我必须在我的 中指定这个。 ext_localconfphp : $GLOBALS ['TYPO3_CONF_VARS'][
我有一个基本扩展,所以我可以对我的网站进行版本控制。这意味着我在扩展上没有 Controller 或存储库。所以我想做的是在现有元素上创建我自己的设置。我正在试验标题内容元素上的文本对齐值。 Keep
我想在后端禁用某些字段,例如网格元素和其他内容元素的许多字段。我知道 TCEFORM 的可能性,但它只允许禁用所有 cTypes 中的一个字段。我需要一种方法来仅针对某些 cTypes 禁用某些字段。
我在 Typo3 4.5 中使用 extbase 和流体进行了扩展。现在要插入一些数据,我使用后端模块“列表”,它使用表格的 TCA 制作一些表格。 为了使选择框可选,我在外部表之前插入一个项目,如下
我是一名优秀的程序员,十分优秀!