Neos 2.0:使用 Eel .trim() 函数时出现“不受信任的上下文”

Neos 2.0: “Untrusted context” when using Eel .trim() function

Root.ts2中,我有这样一行:

content = ${q(node).property('some-property').trim()}

当我在末尾省略 .trim() 时,该行有效。当我包含它时,我收到一条异常消息:“Neos 尝试呈现您的页面时抛出了异常。方法 "trim" 在不受信任的上下文中不可调用。

Neos 文档甚至没有包含“可信”或“不可信”这两个词,所以我不知道是什么原因,以及为什么将其视为不可信。

有什么想法吗?

您可以在 TS2 中使用 Eel 助手。字符串助手 - TYPO3.Eel/Classes/TYPO3/Eel/Helper/StringHelper.php - 具有 trim 方法,可以像这样使用:

content = ${String.trim(q(node).property('some-property'))}

这可能也有帮助 - https://learn-neos.com/blog/hitchhikers-guide-to-typoscript-2-part1.html