Michael Mauracher
Michael Mauracher

Reputation: 201

TYPO3 - fluidstyledcontent wrap element

I would like to add a custom class to the wrap of the whole output of a custom plugin. fluid_styled_content generates the <div id="c55"> tag. There I would like to add the custom class defined in the flexform of the plugin.

Do I have to override the file HeaderContentFooter.html of the fluid_styled_content package or is there a different solution for that problem. If I override that file I can't access the flexform values of the plugin.

I'm thankful for every help.

Cheers

Upvotes: 0

Views: 574

Answers (1)

J&#246;rg velletti
J&#246;rg velletti

Reputation: 136

To copy the layout to your own template folder, this is the best approach to solve this :

I am not sure, why you can't access to the plugin settings. Create a template extension (sitepackage):

copy the file

typo3conf/ext/sitepackage/Resources/Private/Fluid/Content/Layouts/HeaderContentFooter.html

add this to TypoScript:

plugin.tx_sitepackage {
    view {
        templateRootPaths.0 = EXT:sitepackage/Resources/Private/Templates/
        partialRootPaths.0 = EXT:sitepackage/Resources/Private/Partials/
        layoutRootPaths.0 = EXT:sitepackage/Resources/Private/Layouts/
    }
}

add something like this to HeaderContentFooter.html

{namespace css=Vendor\Sitepackage\ViewHelpers}

and to render the CSS class

{css:getclass()}

Create a Viewhelper in sitepackage/Classes/ViewHelpers/getclass.php

with something like this inside:

namespace Vendor\Sitepackage\viewhelper ;

class getclassViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper   {
   public function render() {
        $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
        $configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
        $settings = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT );
      return $settings['FlexFormfieldName'] ;
  }
}

Not tested Completely but should do so

Upvotes: 0

Related Questions