Skip to content

Instantly share code, notes, and snippets.

@fritzmg
fritzmg / MySurcharge.php
Created January 15, 2019 18:18
Custom Contao Isotope Surcharge
<?php
use Isotope\Model\ProductCollection;
class MySurcharge
{
public function findSurchargesForCollection(ProductCollection $collection): array
{
return [\MySurchargeModel::build()];
}
@fritzmg
fritzmg / git-context-global.reg
Created February 24, 2019 18:12
Windows scoop git global context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open Git Bash]
@="Open Git Bash"
"Icon"="C:\\ProgramData\\scoop\\apps\\git\\current\\git-bash.exe"
[HKEY_CLASSES_ROOT\*\shell\Open Git Bash\command]
@="\"C:\\ProgramData\\scoop\\apps\\git\\current\\git-bash.exe\" \"--cd=%1\""
; This will make it appear when you right click ON a folder

Contao News Sync

Contao extension to automatically synchronize news entries between different installations.

Configuration

Install the extension on all Contao installations involved in the news synchronisation. After installation, you will see additional options in your Contao news archives under Synchronisation. In order to enable a news archive to be a source for the synchronisation, simply activate the Source for synchronisation option.

Then, on the target news archive, enable the Target for synchronisation option. You will then see additional options. Under Source URL fill in the URL to the Contao installation, from which you want to fetch news entries. Then save the news archive. After saving you will see the available news archives from the remote Contao installation under News archives. Enable the remote news archives from which you want to fetch news entries, then save again.

@fritzmg
fritzmg / BreadcrumbController.php
Last active July 29, 2025 09:36
Drop-in replacement for Contao's breadcrumb module, in order to have the correct news, event, etc. titles for the active page
<?php
// src/Controller/FrontendModule/BreadcrumbController.php
declare(strict_types=1);
namespace App\Controller\FrontendModule;
use Contao\Controller;
use Contao\CoreBundle\DependencyInjection\Attribute\AsFrontendModule;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
@fritzmg
fritzmg / ChainRouter.php
Last active April 19, 2025 16:10
There is a curious circular dependency issue in Contao 4.13 when you try to decorate (or override) the `router` with your own `ChainRouter`. The first built container example shows the `getRouterService()` method without the decoration, the second with.
<?php
namespace App\Routing;
use Symfony\Cmf\Component\Routing\ChainRouterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
use Symfony\Component\Routing\RequestContext;
class ChainRouter implements ChainRouterInterface, WarmableInterface