0

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

Daniel
  • 6,916
  • 2
  • 36
  • 47

1 Answers1

0

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

David
  • 5,882
  • 3
  • 33
  • 44
  • I tried to solve it like this. My problem is that I can't access the flexform settings inside the HeaderContentFooter.html file. – Michael Mauracher Oct 07 '16 at 22:08
  • I update my answer an added my Plugin flexForm : Maybe you need to put also this line to your Controller : $this->view->assign('settings', $this->settings ); – Jörg velletti Oct 09 '16 at 07:58
  • Forget my first response, as i now understand your problem : You need A Viewhelper that handles the content of the field pi_flexform. i wil add an example for this as separte Answer and delete the first one as it is irrelevant .. . – Jörg velletti Oct 09 '16 at 10:47
  • Thank you for your help. I solved the problem by adding a dataprocessor to lib.fluidContent. – Michael Mauracher Oct 09 '16 at 11:25