| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace Opentalent\OtStats\ViewHelpers;
- use Closure;
- use Opentalent\OtCore\Exception\NoSuchWebsiteException;
- 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
- {
- public function __construct(
- private readonly OtWebsiteRepository $otWebsiteRepository,
- ) {}
- /**
- * -- This method is expected by Fluid --
- * Renders the content as html
- *
- * @return int|null
- * @throws NoSuchWebsiteException
- */
- public function render(): ?int
- {
- $website = $this->otWebsiteRepository->getCurrentWebsiteFromFEGlobals();
- return $website['matomo_site_id'];
- }
- }
|