Skip to content

Commit

Permalink
Added support for wrapper elements, closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Dec 3, 2013
1 parent af6f6f7 commit 11dee60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/MadeYourDay/Contao/CustomElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,9 @@ public static function loadConfig()
if (in_array('content', $types)) {
$contents[] = '$GLOBALS[\'TL_CTE\'][\'' . $contentCategory . '\'][\'' . $template . '\'] = \'MadeYourDay\\\\Contao\\\\Element\\\\CustomElement\';';
$contents[] = '$GLOBALS[\'TL_LANG\'][\'CTE\'][\'' . $template . '\'] = ' . var_export($label, true) . ';';
if (!empty($config['wrapper']['type'])) {
$contents[] = '$GLOBALS[\'TL_WRAPPERS\'][' . var_export($config['wrapper']['type'], true) . '][] = ' . var_export($template, true) . ';';
}
}
if (in_array('module', $types)) {
$contents[] = '$GLOBALS[\'FE_MOD\'][\'' . $moduleCategory . '\'][\'' . $template . '\'] = \'MadeYourDay\\\\Contao\\\\Element\\\\CustomElement\';';
Expand Down
8 changes: 8 additions & 0 deletions src/MadeYourDay/Contao/Element/CustomElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function generate()
{
$this->strTemplate = $this->type;

if (TL_MODE === 'BE' && (
in_array($this->type, $GLOBALS['TL_WRAPPERS']['start'])
|| in_array($this->type, $GLOBALS['TL_WRAPPERS']['stop'])
|| in_array($this->type, $GLOBALS['TL_WRAPPERS']['separator'])
)) {
return '';
}

try {
return parent::generate();
}
Expand Down

0 comments on commit 11dee60

Please sign in to comment.