| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace Opentalent\OtStats\ViewHelpers;
- use Closure;
- use Opentalent\OtCore\Website\OtWebsiteRepository;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Object\ObjectManager;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Returns the current site matomo's id if any, null else
- *
- * {namespace st=Opentalent\OtStats\ViewHelpers}
- *
- * {st:matomoSiteId(slug: 'foo')}
- *
- * @package Opentalent\OtTemplating\ViewHelpers
- */
- class MatomoSiteIdViewHelper extends AbstractViewHelper
- {
- /**
- * -- This method is expected by Fluid --
- * Renders the content as html
- *
- * @param array $arguments
- * @param Closure $renderChildrenClosure
- * @param RenderingContextInterface $renderingContext
- * @return int|null
- */
- public static function renderStatic(
- array $arguments,
- Closure $renderChildrenClosure,
- RenderingContextInterface $renderingContext
- ) {
- $otWebsiteRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtWebsiteRepository::class);
- $website = $otWebsiteRepository->getCurrentWebsiteFromFEGlobals();
- return $website['matomo_site_id'];
- }
- }
|