[英]Typo3 Update: Partial does not render variable content unless f:debug is used
I am working on a typo3 update from 8.7.27 to 9.5.9 and have a problem with one partial in one of our self written extensions.我正在研究从 8.7.27 到 9.5.9 的 typo3 更新,并且在我们自己编写的扩展中的一个部分存在问题。 It only renders the content if I use <f:debug>{_all}</f:debug>
.如果我使用<f:debug>{_all}</f:debug>
,它只会呈现内容。 Otherwise the fields stay empty.否则,这些字段将保持空白。
So far I have tried working my way through the update-guidelines, checked for and updated some deprecated code and tried different spellings, as well as changes to the controller to somehow get a clue where the problem might lie.到目前为止,我已经尝试按照更新指南进行工作,检查并更新了一些不推荐使用的代码,并尝试了不同的拼写,以及对 controller 的更改,以某种方式获得问题可能所在的线索。 So far nothing.到目前为止什么都没有。
The partial is merely a section to display a contact person and looks like this:部分只是显示联系人的部分,如下所示:
<!-- description -->
<div class="abc">
<div class="def">
<div class="col-md-12">
<h2>
<f:translate key="extension_name.contact"/>
</h2>
</div>
<div class="name">{person.firstName} {person.lastName}</div>
<div class="jobtitle">{person.jobTitle}</div>
<div class="col-md-4">
<i class="fal fa-envelope"></i>
<f:link.email email=" {person.email}"></f:link.email>
</div>
</div>
</div>
Everything that comes from the person-Object is not returned to the frontend.来自 person-Object 的所有内容都不会返回到前端。
If I now add <f:debug>{_all}</f:debug>
or <f:debug>{person}</f:debug>
it works just fine (same if I use the var_dump-class inside the controller) and I get all the content.如果我现在添加<f:debug>{_all}</f:debug>
或<f:debug>{person}</f:debug>
它工作得很好(如果我在控制器内使用 var_dump-class 也是如此)我得到了所有的内容。 But <f:debug>{person.firstName}</f:debug>
(or any other variable) results in NULL being returned even though the debugger clearly shows that the values are there and the paths are also correct.但是<f:debug>{person.firstName}</f:debug>
(或任何其他变量)会导致返回 NULL ,即使调试器清楚地显示值在那里并且路径也是正确的。
I'm not assuming a bug in the code.我没有假设代码中有错误。 Probably some misconfiguration?可能是配置错误? The "Extbase Variable Dump"-div is also rendered three times, which might hint at the problem, but I'm completely out of ideas where I might look. “Extbase 变量转储”-div 也被渲染了 3 次,这可能暗示了这个问题,但我完全不知道我可能在哪里寻找。
It would be greatly appreciated if someone had a pointer or two in which direction I might research further.如果有人能指点一两个我可以进一步研究的方向,将不胜感激。 Sadly I am completely out of ideas.可悲的是,我完全没有想法。
If the data for "person" comes from a 1:1 relation, check once if the model has a @lazy.如果“人”的数据来自 1:1 关系,请检查 model 是否有 @lazy。 If so, remove the @lazy.如果是这样,请删除@lazy。
Unfortunately something has changed in the "typo3fluid/fluid": "2.6.7".不幸的是,“typo3fluid/fluid”发生了一些变化:“2.6.7”。 So that at 1: 1 relations @ Lazy no longer works without detours.让@Lazy 1:1 的关系不再走弯路。
See also: https://github.com/TYPO3/Fluid/pull/489 https://github.com/TYPO3/Fluid/pull/486#issuecomment-545661652另见: https://github.com/TYPO3/Fluid/pull/489 https://github.com/TYPO3/Fluid/pull/486#issuecomment-545661652
How do you insert the partial in your page?如何在页面中插入部分内容?
In 9.5 and higher I think you need to give the variable as argument to the partial call.在 9.5 及更高版本中,我认为您需要将变量作为参数提供给部分调用。
<f:render partial="path/to/partial" arguments="{variableInPartial: variableInCallingPage}" />
or <f:render partial="path/to/partial" arguments="{_all}" />
<f:render partial="path/to/partial" arguments="{variableInPartial: variableInCallingPage}" />
或<f:render partial="path/to/partial" arguments="{_all}" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.