Skip to content

Instantly share code, notes, and snippets.

View georgringer's full-sized avatar

Georg Ringer georgringer

View GitHub Profile
<?php
namespace GeorgRinger\News\ViewHelpers\Format;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* This file is part of the "news" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
@georgringer
georgringer / setup.typoscript
Last active September 18, 2019 07:37
Google Tag Manager with CMS 9. The Site module is extended to allow site admins to edit the GTM code
page {
headerData.50 = TEXT
headerData.50 {
if.isTrue.data = site:googleTagManager
stdWrap.replacement {
10 {
search = ###CODE###
replace.data = site:googleTagManager
}
@georgringer
georgringer / HrefLangNews.php
Last active November 13, 2019 16:39
Get relevant langage ids for menus, e.g. hreflang or language switch
<?php
namespace GeorgRinger\News\Hooks;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Get language ids for news language menu
*
@georgringer
georgringer / HrefLangGenerator.php
Created September 17, 2019 12:18
Allow fallbacks for hreflang in TYPO3 9
<?php
declare(strict_types=1);
namespace JosefGlatz\Theme\Xclass;
use JosefGlatz\Theme\Service\LanguageAvailability;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor;
use TYPO3\CMS\Seo\HrefLang\HrefLangGenerator;
@georgringer
georgringer / XclassedRedirectService.php
Created October 28, 2019 10:21
Redirects to records XCLASS
<?php
declare(strict_types = 1);
namespace Vendor\Theme\Xclass;
use Psr\Http\Message\UriInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Core\LinkHandling\LinkService;
@georgringer
georgringer / EmailValidator.php
Last active December 14, 2020 19:16
Powermail check if value is same in other fields, like for email double validation
<?php
namespace VENDOR\EXT\Domain\Powermail;
use In2code\Powermail\Domain\Model\Mail;
use In2code\Powermail\Domain\Validator\AbstractValidator;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Error\Result;
class EmailValidator extends AbstractValidator
@georgringer
georgringer / news-sharing.html
Created May 27, 2021 09:11
Share news article without any extra ext
<nav class="newsdetail__sharing-sidebar" role="navigation" aria-label="sharing">
<f:variable name="currentUrl">{n:link(newsItem:newsItem,uriOnly:1,configuration:{forceAbsoluteUrl:1}) -> f:format.htmlentities()}</f:variable>
<a target="_blank" rel="noopener" title="Auf Facebook teilen" href="https://www.facebook.com/sharer/sharer.php?u={currentUrl}" class="newsdetail__sharing-sidebar__link"><span class="fab fa-facebook">&nbsp;</span></a>
<a target="_blank" rel="noopener" title="Auf twitter teilen" href="https://twitter.com/share?url={currentUrl}" class="newsdetail__sharing-sidebar__link"><span class="fab fa-twitter">&nbsp;</span></a>
<a target="_blank" rel="noopener" title="Auf pinterest teilen" href=
"https://pinterest.com/pin/create/button/?url={currentUrl}" class="newsdetail__sharing-sidebar__link"><span class="fab fa-pinterest">&nbsp;</span></a>
<a target="_blank" rel="noopener" title="via email teilen" href=
"mailto:?subject=XYZ%20empfiehlt%20{newsItem.title}" class="ne
@georgringer
georgringer / CategoryViewHelper.php
Last active November 3, 2021 09:50
Get categories of a table
<?php
declare(strict_types=1);
namespace GeorgRinger\SitePackage\ViewHelpers;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Resource\FileRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
@georgringer
georgringer / Readme.md
Last active April 4, 2022 05:06
Getting the exception Symfony\Component\RateLimiter\Policy\SlidingWindow::getExpirationTime(): Return value must be of type int, float returned

About error SlidingWindow::getExpirationTime(): Return value must be of type int,

This gist should help you if you are getting the following exception in your TYPO3 website Symfony\Component\RateLimiter\Policy\SlidingWindow::getExpirationTime(): Return value must be of type int, float returned.

The following requirements must be set to be affected:

  • TYPO3 11.5
  • PHP 8.1. Read more about the relevant changes at php.watch
  • Package symfony/rate-limiter in version 5.4.7 (released 2022-04-02)
  • Deprecations notices are converted into exceptions
@georgringer
georgringer / AfterFlexFormDataStructureParsedEventListener.php
Last active February 13, 2024 19:45
Add fields to ext:news v11 flexform with TYPO3 v12
<?php
declare(strict_types=1);
namespace Vendor\Extension\EventListener;
use TYPO3\CMS\Core\Configuration\Event\AfterFlexFormDataStructureParsedEvent;
class AfterFlexFormDataStructureParsedEventListener
{