Skip to content

Instantly share code, notes, and snippets.

@aertmann
aertmann / FlickrOperation.php
Created March 26, 2015 23:10
Get custom data (Flickr feed) in TypoScript using a custom FlowQuery operation in Neos – Included in https://speakerdeck.com/aertmann/tasty-recipes-for-every-day-neos
<?php
namespace Venstre\VenstreDk\TypoScript\FlowQueryOperations;
use TYPO3\Eel\FlowQuery\FlowQuery;
use TYPO3\Eel\FlowQuery\Operations\AbstractOperation;
use TYPO3\Flow\Annotations as Flow;
class FlickrOperation extends AbstractOperation {
const API_KEY = '';
<?php
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \TYPO3\Surf\Application\TYPO3\Flow();
$application->setOption('repositoryUrl', '[email protected]:acme/acme.git');
$application->setOption('localPackagePath', FLOW_PATH_DATA . 'Checkout' . DIRECTORY_SEPARATOR . $deployment->getName() . DIRECTORY_SEPARATOR . 'Live' . DIRECTORY_SEPARATOR);
$application->setOption('composerCommandPath', 'composer');
$application->setOption('transferMethod', 'rsync');
$application->setOption('rsyncFlags', '--recursive --times --perms --links --delete');
$application->setOption('packageMethod', 'git');
@aertmann
aertmann / .gitignore
Last active October 28, 2015 05:14
Neos site versioning with one repository – Included in https://speakerdeck.com/aertmann/tasty-recipes-for-every-day-neos
/Build/**
!/Build/Surf**
/Configuration/**
!/Configuration/**.yaml
/Data/
/Web/
/bin/
/Readme.txt
/Upgrading.txt
/flow
@aertmann
aertmann / gist:33c74c10f76edc26ed67
Last active April 23, 2018 11:28
Add target _blank to external links in Neos – Included in https://speakerdeck.com/aertmann/tasty-recipes-for-every-day-neos
<?php
namespace Acme\Acme\TypoScript;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Neos\Domain\Exception;
use TYPO3\Neos\Service\LinkingService;
use TYPO3\TYPO3CR\Domain\Model\NodeInterface;
use TYPO3\TypoScript\TypoScriptObjects\AbstractTypoScriptObject;
/**
@aertmann
aertmann / Latest.php
Last active August 29, 2015 14:16
Surf deployment script
<?php
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \TYPO3\Surf\Application\TYPO3\Flow();
$application->setOption('repositoryUrl', '[email protected]:Distributions/Acme');
$application->setOption('localPackagePath', FLOW_PATH_DATA . 'Checkout' . DIRECTORY_SEPARATOR . $deployment->getName() . DIRECTORY_SEPARATOR . 'Latest' . DIRECTORY_SEPARATOR);
$application->setOption('composerCommandPath', 'composer');
$application->setOption('transferMethod', 'rsync');
$application->setOption('rsyncFlags', '--recursive --times --perms --links --delete');
@aertmann
aertmann / gist:822069d318febcbd65bd
Last active August 29, 2015 14:15
Pull from Gerrit mirror instead of git.typo3.org (temporary fix)
git config --global url."https://git.typo3.org".insteadOf git://git.typo3.org
@aertmann
aertmann / .gitignore
Last active April 6, 2016 15:14
Neos installation versioning (.gitignore)
/Build/**
!/Build/Surf**
/Configuration/**/Settings.yaml.example
/Configuration/Settings.yaml
/Configuration/**/*.php
/Configuration/*.php
/Configuration/README
/Configuration/Testing
/Data/
@aertmann
aertmann / Live.php
Created February 5, 2015 14:00
Clear caches when deploying using Surf with custom cache backends
$workflow->defineTask('typo3.surf:shell:clearRedisCaches',
'typo3.surf:shell',
array('command' => 'cd {releasePath} && FLOW_CONTEXT=Production/Live ./flow cache:flushone TYPO3_TypoScript_Content && FLOW_CONTEXT=Production/Live ./flow cache:flushone Flow_Mvc_Routing_Resolve && FLOW_CONTEXT=Production/Live ./flow cache:flushone Flow_Mvc_Routing_Route')
);
$workflow->beforeStage('switch', array('typo3.surf:shell:clearRedisCaches'), $application);
root {
rss {
position = 'before format'
condition = ${request.parentRequest.uri.path == '/rss.xml'}
renderPath = '/rss'
}
@cache {
entryIdentifier {
path = ${request.parentRequest.uri.path}
}
<?php
namespace Acme\Package\TypoScript\FlowQueryOperations;
use TYPO3\Eel\FlowQuery\FlowQuery;
use TYPO3\Eel\FlowQuery\Operations\AbstractOperation;
use TYPO3\Flow\Annotations as Flow;
class MediaOperation extends AbstractOperation {
/**