image

TYPO3 8 Adding custom section frame to Gridelements on frame_class value

Sometimes Section Frames need to be added to grid elements on frame_class value that is selected. This can be done in the following way.

Add the following to PageTS config of root page.

TCEFORM.tt_content.frame_class.addItems {
    custom-1 = Custom Wrap 1
    custom-2 = Custom Wrap 2
}

This will allow you to select the Section Frame.

Now to render the class in frontend you need to have this in your setup.

tt_content.gridelements_pi1.stdWrap.wrap.cObject = CASE
tt_content.gridelements_pi1.stdWrap.wrap.cObject {
    key.field = frame_class
    default = TEXT
    default.value = <div class="frame"> | </div>
    custom-1 = TEXT
    custom-1.value = <div class="frame custom-class-1"> | </div>
    custom-2 = TEXT
    custom-2.value = <div id="{field:uid}" class="frame custom-class-2"> | </div>
    custom-2.insertData = 1
}

 

To get the same class like in TCEFORM, add following

tt_content.gridelements_pi1.stdWrap.wrap = <div id="{field:uid}" class="frame frame-{frame_class}"> | </div>
tt_content.gridelements_pi1.stdWrap.wrap.insertData = 1