[TYPO3-mvc] writing Hook for css_styled_content
Johannes C. Schulz - EnzephaloN IT-Solutions
info at enzephalon.de
Thu Apr 11 13:47:15 CEST 2013
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
More information about the TYPO3-project-typo3v4mvc
mailing list