Skip to content

Instantly share code, notes, and snippets.

@dimaip
dimaip / ImageUri.ts2
Created September 28, 2016 14:39
Handy way to show dummy image if no image is selected
prototype(Sfi.Site:ImageUri) < prototype(TYPO3.TypoScript:Case) {
image {
condition = ${asset}
renderer = ImageUri {
asset = ${asset}
width = ${width}
height = ${height}
maximumWidth = ${maximumWidth}
maximumHeight = ${maximumHeight}
allowCropping = ${allowCropping}
@jonnitto
jonnitto / Overwrite.fusion
Last active January 14, 2020 08:19
Neos.io: Add a little hint if the shown content is from a different content dimension
prototype(Neos.Neos:Content) {
@process.contentDimensions {
expression = Foo.Bar:ShowContentDimensions
@position = 'end'
}
}
prototype(Neos.Neos:ContentComponent) {
@process.contentDimensions {
expression = Foo.Bar:ShowContentDimensions
@bwaidelich
bwaidelich / ActionIfGrantedViewHelper.php
Created June 15, 2016 10:04
A simple Neos Flow ViewHelper that only renders an action link if the target action is granted by the currently authenticated account. Otherwise it will only render the link text
<?php
namespace Your\Package\ViewHelpers\Link;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Aop\JoinPoint;
use TYPO3\Flow\Mvc\ActionRequest;
use TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeInterface;
use TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeSubject;
use TYPO3\Flow\Security\Authorization\PrivilegeManagerInterface;
use TYPO3\Fluid\ViewHelpers\Link\ActionViewHelper;
@christianhaendel
christianhaendel / pageNotFoundHandling.php
Created June 11, 2016 15:12
Enable Realurl to select individual errorPage
<?php
class user_pageNotFound {
function pageNotFound($params,$tsfeObj) {
global $TYPO3_CONF_VARS;
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$TYPO3_CONF_VARS['EXTCONF']['realurl'][\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST')]['errorPage'];
$_buffer = $this->loadPage($url);
echo $_buffer;
@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;
/**
@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 <[email protected]>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
@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 / 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;
@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:
@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. *
* *