[TYPO3-mvc] writing Hook for css_styled_content
chris Wolff
chris at connye.com
Thu Apr 11 15:53:12 CEST 2013
warum brauchst du denn dort ein !important? für mich klingt das als
würd irgend eines deiner Stylsheets da was überschreiben was es nicht
sollte. vieleicht ist es einfacher dein stylesheet zu säubern?
gruss chris
2013/4/11 Johannes C. Schulz - EnzephaloN IT-Solutions <info at enzephalon.de>:
> Hello MVC-friends
>
>
>
> Today I tried to hook css_styled_content, cause I need a "!IMPORTANT" inside
> the css generated by renderSpace-function. So I wrote an little extension,
> but it dowsn't work:
>
>
>
> ext_localconf.php:
>
> <?php
>
> if (!defined ('TYPO3_MODE'))
>
> die ('Access denied.');
>
> $TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks']['renderSpace'
>
> ] =
> 'EXT:enzcschook/Classes/Hook/HookHandler:Tx_Enzcsc_Hooks_HookHandler->render
> Space';
>
> ?>
>
> Classes/Hook/HookHandler.php:
>
> <?php
>
> class Tx_Enzcsc_Hook_HookHandler{
>
> * @param string $content Content input. Not used, ignore.
>
> * @param array $configuration TypoScript configuration
>
> * @return string The class name
>
> */
>
> function renderSpace($content, array $configuration) {
>
> if (isset($configuration['space']) &&
>
> in_array($configuration['space'], array('before', 'after'))) {
>
> $constant = (int)
> $configuration['constant'];
>
> if ($configuration['space']
> === 'before') {
>
> $value =
> $constant +
>
> $this->cObj->data['spaceBefore'];
>
> $declaration
> = 'margin-top: ' . $value .'px !IMPORTANT;';
>
> } else {
>
> $value =
> $constant +
>
> $this->cObj->data['spaceAfter'];
>
> $declaration
> = 'margin-bottom: ' . $value .
>
> 'px !IMPORTANT;';
>
> }
>
> [...more code.]
>
> If I do a vardump($hookObj) in
> sysext/csc_styled_content/Classes/CssStyledContentController.php, the
> vardump-output is "NULL". So I guess, there is something wrong with my
> ext_localconf.php.
>
>
>
> Hope some of you can help me out!
>
>
>
> Johannes
>
>
>
>
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
--
christian wolff - webdeveloper, tech-loving geek and typo3 enthusiast
telefon: +49 30 347 244 88
mobil: +49 179 49 44 758
email: chris at connye.com
adresse: friedelstraße 31 - 12047 berlin
xing-profil: http://www.xing.com/profile/Christian_Wolff43
google+: https://plus.google.com/u/0/115669673917212236875/posts?hl=de
facebook: https://www.facebook.com/1stMachine
flattr: https://flattr.com/profile/1stmachine
More information about the TYPO3-project-typo3v4mvc
mailing list