Commit 2507ddaf authored by Thomas Löffler's avatar Thomas Löffler

Update template for t3o and load JS only if action is called

* Plus some CGL
parent 889da44f
......@@ -18,7 +18,6 @@ use T3o\Randombanners\Domain\Repository\BannerRepository;
/**
* Class BannerController
* @package T3o\Randombanners\Controller
*/
class BannerController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
......@@ -27,16 +26,6 @@ class BannerController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
* */
protected $bannerRepository;
/**
* @return void
*/
public function indexAction()
{
$banners = $this->bannerRepository->findAll();
$this->view->assign('banners', $banners);
$this->view->assign('contentData', $this->configurationManager->getContentObject()->data);
}
/**
* @param BannerRepository $bannerRepository
*/
......@@ -44,4 +33,12 @@ class BannerController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
{
$this->bannerRepository = $bannerRepository;
}
}
\ No newline at end of file
public function indexAction()
{
$this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class)
->addJsFooterFile('EXT:randombanners/Resources/Public/Javascript/randombanners.js');
$this->view->assign('banners', $this->bannerRepository->findAll());
$this->view->assign('contentData', $this->configurationManager->getContentObject()->data);
}
}
......@@ -20,5 +20,3 @@ plugin.tx_randombanners {
linkAttributeRel = nofollow
}
}
page.includeJSFooter.randombanners = EXT:randombanners/Resources/Public/Javascript/randombanners.js
\ No newline at end of file
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="content">
<ul class="t3o-banners t3js-banners">
<f:for each="{banners}" as="banner">
<li>
<f:link.external class="t3js-banner" uri="{f:uri.external(uri: banner.link)}" target="_blank" additionalAttributes="{data-uid: banner.uid, rel: settings.linkAttributeRel}">
<f:for each="{banner.logo}" as="logo">
<f:image image="{logo}" alt="{banner.name}" maxHeight="50" maxWidth="150" />
</f:for>
</f:link.external>
</li>
</f:for>
</ul>
<div class="container">
<h2 class="text-center">{contentData.header}</h2>
<h3 class="text-center">{contentData.subheader}</h3>
<ul class="t3o-banners t3js-banners text-center">
<f:for each="{banners}" as="banner">
<li>
<f:link.external class="t3js-banner" uri="{f:uri.external(uri: banner.link)}" target="_blank" additionalAttributes="{data-uid: banner.uid, rel: settings.linkAttributeRel}">
<f:image image="{banner.logo.0}" alt="{banner.name}" maxWidth="150" />
</f:link.external>
</li>
</f:for>
</ul>
</div>
</f:section>
</html>
<?php
defined('TYPO3_MODE') or die();
defined('TYPO3_MODE') || die();
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_randombanners_domain_model_banner');
#\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_randombanners_domain_model_banner', 'EXT:randombanners/Resources/Private/Language/locallang_csh_tx_randombanners_domain_model_banner.xlf');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment