ChriK
ChriK

Reputation: 43

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. It only renders the content if I use <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. 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.

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. 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.

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.

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.

Upvotes: 0

Views: 827

Answers (2)

Fritz the Cat
Fritz the Cat

Reputation: 46

If the data for "person" comes from a 1:1 relation, check once if the model has a @lazy. If so, remove the @lazy.

Unfortunately something has changed in the "typo3fluid/fluid": "2.6.7". So that at 1: 1 relations @ Lazy no longer works without detours.

See also: https://github.com/TYPO3/Fluid/pull/489 https://github.com/TYPO3/Fluid/pull/486#issuecomment-545661652

Upvotes: 2

mazorius
mazorius

Reputation: 31

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.

<f:render partial="path/to/partial" arguments="{variableInPartial: variableInCallingPage}" /> or <f:render partial="path/to/partial" arguments="{_all}" />

Upvotes: 0

Related Questions