Skip to content

Commit

Permalink
Merge pull request FluidTYPO3#859 from bjo3rnf/gutentag
Browse files Browse the repository at this point in the history
[BUGFIX] Force closing tag and render comment
  • Loading branch information
cedricziel committed Jul 22, 2015
2 parents ceef869 + a01215c commit b5f8298
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Classes/Service/AssetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,29 +340,35 @@ private function writeCachedMergedFileAndReturnTag($assets, $type) {
private function generateTagForAssetType($type, $content, $file = NULL) {
/** @var \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder $tagBuilder */
$tagBuilder = $this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder');
if (NULL === $file && TRUE === empty($content)) {
$content = '<!-- Empty tag content -->';
}
switch ($type) {
case 'js':
$tagBuilder->setTagName('script');
$tagBuilder->forceClosingTag(TRUE);
$tagBuilder->addAttribute('type', 'text/javascript');
if (NULL === $file) {
$tagBuilder->setContent($content);
} else {
$tagBuilder->addAttribute('src', $file);
$tagBuilder->forceClosingTag(TRUE);
}
break;
case 'css':
if (NULL === $file) {
$tagBuilder->setTagName('style');
$tagBuilder->forceClosingTag(TRUE);
$tagBuilder->addAttribute('type', 'text/css');
$tagBuilder->setContent($content);
} else {
$tagBuilder->forceClosingTag(FALSE);
$tagBuilder->setTagName('link');
$tagBuilder->addAttribute('rel', 'stylesheet');
$tagBuilder->addAttribute('href', $file);
}
break;
case 'meta':
$tagBuilder->forceClosingTag(FALSE);
$tagBuilder->setTagName('meta');
break;
default:
Expand Down

0 comments on commit b5f8298

Please sign in to comment.