StatsSettingsRepository.php 795 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Opentalent\OtStats\Settings;
  3. use Opentalent\OtCore\Website\OtWebsiteRepository;
  4. use TYPO3\CMS\Core\Utility\GeneralUtility;
  5. use TYPO3\CMS\Extbase\Object\ObjectManager;
  6. /**
  7. * Class StatsRepository
  8. *
  9. * Give access to the website's settings for the stats module
  10. *
  11. * @package Opentalent\OtTemplating\Page
  12. */
  13. class StatsSettingsRepository
  14. {
  15. /**
  16. * Returns the website registered matomo site's id
  17. * @param int $rootPageUid
  18. * @return int|null
  19. */
  20. public function getMatomoSiteId(int $rootPageUid): ?int
  21. {
  22. $otWebsiteRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtWebsiteRepository::class);
  23. $website = $otWebsiteRepository->getWebsiteByPageUid($rootPageUid);
  24. return $website['matomo_site_id'];
  25. }
  26. }