Gernott / mask

TYPO3 Extension Mask
https://www.facebook.com/typo3mask
GNU General Public License v2.0
130 stars 86 forks source link

Nested and hidden/disabled mask content elements not visible in backend preview #620

Closed Wintermilch closed 9 months ago

Wintermilch commented 9 months ago

Using TYPO3 12.4.10 and Mask 8.3.8

I'm using custom templates for the backend preview of my mask elements. In these previews I'm also showing the nested/child elements.

Now if any element has nested elements, the preview works fine. Example: image

But if I hide a nested record, it'll disappear but it shows up in the edit view. (it is not deleted): image

I've searched through the code and found why this does not work. Inside the InlineHelper class I've found this line which checks if we are in work space preview mode: https://github.com/Gernott/mask/blob/ead5ddbfbec2492bee71ed7712d227258efb7dca/Classes/Helper/InlineHelper.php#L264 But in the page module the workspace id is 0. So changing the condition to $workSpaceId >= 0; will then remove the querybuilder restrictions some lines later.

Then in this line the condition for the disabled field had to be removed in order not continue the loop. https://github.com/Gernott/mask/blob/ead5ddbfbec2492bee71ed7712d227258efb7dca/Classes/Helper/InlineHelper.php#L309

With these 2 adjustments, my preview works fine again: image

NOTE: This does not happen if nested element is from tt_content table.

nhovratov commented 9 months ago

@Wintermilch I had the false assumption back then that hidden records should not be displayed in backend previews. This is now fixed.

NOTE: This does not happen if nested element is from tt_content table.

Yes! This is because they are handled differentely (better) than Inline fields. This should ideally be unified so everything behaves identically. This is a very legacy part of the Mask Code. However, my focus is currently on Content Blocks and I won't be doing larger refactorings of the Mask Code for the forseeable future.