Skip to content

Instantly share code, notes, and snippets.

<f:flashMessages severity="OK" as="flashMessagesOK">
<ul class="alert alert-success list-unstyled">
<f:for each="{flashMessagesOK}" as="flashMessage">
<li>{flashMessage}</li>
</f:for>
</ul>
</f:flashMessages>
<f:flashMessages severity="Notice" as="flashMessagesNotice">
<ul class="alert alert-info list-unstyled">
<f:for each="{flashMessagesNotice}" as="flashMessage">
@lorenzulrich
lorenzulrich / ResourceBuiltVersionViewHelper.php
Created April 5, 2016 17:49
ViewHelper used to return a version number of a resource based on the MD5 hash of a file.
<?php
namespace Acme\Demo\ViewHelpers;
/**
* ResourceBuiltVersion
*
* ViewHelper used to return a version number of a resource based on the MD5 hash of a file.
*
* Useful to prevent caching issues with static resources.
*
@lorenzulrich
lorenzulrich / Settings.yaml
Created June 7, 2016 17:36
Re-using TYPO3 CMS (salted MD5) passwords in Flow
TYPO3:
Flow:
security:
cryptography:
hashingStrategies:
typo3md5salted: Vendor\Package\Security\Cryptography\Typo3Md5SaltedHashingStrategy
@lorenzulrich
lorenzulrich / dropAllTablesFromDatabase.sh
Created June 22, 2016 22:37
Drop all tables from MySQL database without root privileges
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@lorenzulrich
lorenzulrich / MediaContentMigrationCommandController.php
Last active November 24, 2017 18:49
Command controller for TYPO3 7 LTS+ to migrate CType Media containing YouTube and Vimeo videos to CType textmedia using file references
<?php
namespace Visol\Foobar\Command;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelperRegistry;
use TYPO3\CMS\Core\Resource\ResourceFactory;
@lorenzulrich
lorenzulrich / ContainsReferenceToNodeOperation.php
Last active January 23, 2018 18:25
Neos CMS FlowQuery operation to filter a collection of Nodes having a reference to a given Node
<?php
namespace Visol\FoobarCom\FlowQuery\Operation;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Eel\FlowQuery\Operations\AbstractOperation;
class ContainsReferenceToNodeOperation extends AbstractOperation
{
@lorenzulrich
lorenzulrich / Example.fusion
Last active January 20, 2018 21:18
Neos CMS Eel Helper to get configuration of NodeTypes
# In this example, I want to render the same <select> box as a filter in the frontend I use to categorize a Node in the backend
@context.offerTypeSettings = ${Visol.NodeTypeConfigurationHelper.setting('My.FoobarCom:Document.Offer', 'properties.offerType.ui.inspector.editorOptions.values')}
offerTypes = Neos.Fusion:Collection {
collection = ${offerTypeSettings}
itemRenderer = ${'<option value="' + itemKey + '">' + item.label + '</option>'}
}
@lorenzulrich
lorenzulrich / AbstractApiController.php
Created April 23, 2018 15:07
TraceableJob for Flow Framework
<?php
namespace Visol\Foo\Controller;
/*
* This file is part of the Visol.Foo package.
*/
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Mvc\Controller\ActionController;
use TYPO3\Flow\Mvc\View\JsonView;
@lorenzulrich
lorenzulrich / typo3-cms-linkhandler-record-and language-link-migration.patch
Created June 25, 2018 18:08
TYPO3 8.7: Core patch to migrate links from EXT:linkhandler to built-in link handling functionality
@lorenzulrich
lorenzulrich / BgSetUsage.html
Last active November 14, 2018 21:00
ResponsiveImageViewHelper and SrcSetViewHelper for Responsive Images using lazysizes/bgset
<div class="lazyload" data-bgset="{v:srcSet(image: media.1, ratio: 1, maxWidth: 1920)}">
Foo
</div>
{namespace v=Visol\Foobar\ViewHelpers}