Skip to content

Instantly share code, notes, and snippets.

@pumatertion
pumatertion / AbstractMyController.php
Last active June 28, 2016 14:35
TYPO3 Flow Setting Locale How to detect User Language from HTTP Accept Language for usage by translateViewHelper
<?php
abstract class AbstractMyController extends extends \TYPO3\Flow\Mvc\Controller\ActionController {
/**
* @Flow\Inject
* @var \TYPO3\Flow\I18n\Service
*/
protected $i18nService;
@bwaidelich
bwaidelich / Settings.yaml
Last active September 22, 2022 16:19
A simple example showing how doctrine behaviors (in this chase soft-deleteable) can be used within TYPO3 Flow.
TYPO3:
Flow:
# disable reflection for non psr-0 compliant 3rd party packages
object:
excludeClasses:
'gedmo.doctrineextensions' : ['Gedmo\\.*']
# register soft deletable filter & event listeners
persistence:
doctrine:
@revsbech
revsbech / MyPluginController.php
Created June 30, 2014 08:01
Various Neos plugin snippets
/*
Accessing the current node or page (documentNde)
*/
/** @var \TYPO3\TYPO3CR\Domain\Model\Node $currentNode */
$currentNode = $request->getInternalArgument('__node');
/** @var \TYPO3\TYPO3CR\Domain\Model\Node $currentNode */
$currentPage = $request->getInternalArgument('__documentNode');
/*
@oliverthiele
oliverthiele / ModelController.php
Created July 22, 2014 20:33
Debugging errors like "An error occurred while trying to call Vendor\ExtKey\Controller\ModelController->showAction() " in extbase extensions
/**
* A special action which is called if the originally intended action could
* not be called, for example if the arguments were not valid.
*
* The default implementation sets a flash message, request errors and forwards back
* to the originating action. This is suitable for most actions dealing with form input.
*
* We clear the page cache by default on an error as well, as we need to make sure the
* data is re-evaluated when the user changes something.
*
@jrenggli
jrenggli / ResourceModificationTimeAspect.php
Last active August 29, 2015 14:16
Add timestamp to resource links in TYPO3 Flow. (Thanks to Sascha and Visay)
<?php
namespace WE\BaseBox\Aspects;
/* *
* This script belongs to the TYPO3 Flow package "WE.BaseBox". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
@aertmann
aertmann / Caches.yaml
Last active January 16, 2017 14:15
Keep session storage through cache flushing to prevent users being logged out in Neos – Included in https://speakerdeck.com/aertmann/tasty-recipes-for-every-day-neos
# Flow 3.0+
Flow_Session_Storage:
persistent: TRUE
Flow_Session_MetaData:
persistent: TRUE
# Flow 2.0-2.3 (only works with Surf deployment – not flow:cache:flush command)
Flow_Session_Storage:
backendOptions:
@htuscher
htuscher / UrlCommandController.php
Last active July 31, 2018 12:03
Create frontend URIs from neos backend (CLI)
<?php
namespace Vendor\Site\Command;
use Vendor\Site\Service\SocialSharesService;
use TYPO3\Eel\FlowQuery\FlowQuery;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Cli\CommandController;
use TYPO3\Flow\Configuration\ConfigurationManager;
use TYPO3\Flow\Http\Request;
@pgampe
pgampe / menu.ts
Last active August 4, 2020 12:51
Fully cached menu with TypoScript
page.10 >
page.10 = COA
page.10 {
cache {
key = main-menu
}
10 = TEXT
10 {
@htuscher
htuscher / ExtbaseForceLanguage.php
Last active August 29, 2023 11:04
TYPO3 Extbase get record with language different than FE or 0
<?php
namespace Onedrop\Common\Service;
/***************************************************************
* Copyright notice
*
* (c) 2015 Hans Höchtl <hhoechtl@1drop.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
@bwaidelich
bwaidelich / Jwt.php
Last active May 13, 2020 11:54
External authentication with Neos Flow and local JWT (http://jwt.io/) as cache
<?php
declare(strict_types=1);
namespace Your\Package\Security\Authentication;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Security\Authentication\Token\AbstractToken;
use Neos\Flow\Security\Authentication\Token\SessionlessTokenInterface;
/**