0

When adding Mask content element it doesn't reflect some setting of the Appearance tab at front-end, like Layout, Frame, Space Before or After, also it doesn't include the uid of content element. How can I make usage of these fields?

David
  • 5,882
  • 3
  • 33
  • 44
biesior
  • 55,576
  • 10
  • 125
  • 182

2 Answers2

1

By default Mask elements do not use standard wrapping for rendering the content element, fortunately you can easily access them within data variable which contains array of tt_content.

To check what fields of tt_content are available just put the line in FE template of your Mask element:

<f:debug>{data}</f:debug>

So you can make the wrapper div by yourself using simple Fluid syntax

<div class="
        {f:if(condition: data.layout, then: 'frame-layout-{data.layout}')}
        {f:if(condition: data.frame_class, then: 'frame-{data.frame_class}')}
        {f:if(condition: data.space_before_class, then: 'frame-space-before-{data.space_before_class}')}
        {f:if(condition: data.space_after_class, then: 'frame-space-after-{data.space_after_class}')} ">

    <!-- your markup here -->
</div>
biesior
  • 55,576
  • 10
  • 125
  • 182
0

You can use the layouts like fluid_styled_content does - it takes care of headers, frames, spaceBefore, etc. This is also the easiest way.

First step: define the layout directories in TypoScript:

lib.maskContentElement.layoutRootPaths.5 = EXT:fluid_styled_content/Resources/Private/Layouts/
lib.maskContentElement.partialRootPaths.5 = EXT:fluid_styled_content/Resources/Private/Partials/

Second step: use the layout in your template:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />

<f:section name="Main">

  <!-- your markup here -->

</f:section>

</html>

This also works for DCE (with corresponding TypoScript path)

Of course you can copy the layouts and partials to your theme path and make changes there, but I recommend sticking to the core functionality.

Markus
  • 119
  • 4