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;
<trans-unit id="error.1238108069">
<source>This text may not exceed {0} characters</source>
<target>Darf maximal {0} Zeichen beinhalten</target>
</trans-unit>
error.code is 1238108069:
<f:translate id="error.{error.code}" arguments="{error.arguments}">{error}</f:translate>
but it allways prints not the xliff stuff but the __toString of error :(
/**
* 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.
*
* @return string
* @api
*/
@pumatertion
pumatertion / PersistentObjectConverter.php
Created February 25, 2013 13:04
Respect "effectiveTargetType" on childProperties of a Collection
<?php
namespace TYPO3\Flow\Property\TypeConverter;
/* *
* This script belongs to the TYPO3 Flow framework. *
* *
* 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. *
* *
{
"resource":{
"title":"Kunstwerk XYZ",
"properties":[
{
"type":{
"title":"Artist"
},
"abstractValueObjects":[
{"__type":"\\BLEICKER\\Product\\Domain\\Model\\PersonNameValueObject","alias":"Fischli/Weiss","abstractValueObjects":[
@pumatertion
pumatertion / Distance.php
Created February 28, 2013 10:21
Distance Converting Class
<?php
namespace TYPO3\Units\UnitType;
use TYPO3\Units\Error\UnitConstantException;
/**
* Class to convert distance unit values into others
* For example it converts meter to inch and backwards
* or Megameter in mile
@pumatertion
pumatertion / uuid.txt
Created May 12, 2013 14:12
UUID usage in TYPO3 Core
I would like to enable uuid support in typo3.
I would like also backport the uuid generation of flow wich has a php script to generate uuid.
This could be used in Generic Backend on insert to generate the uuid.
But what about the backend? there is no extbase persistence.
So what about switching the uid fields from integer to varchar.
Removing auto increment and put a trigger on any typo3 tables like this one:
DELIMITER //
CREATE TRIGGER `tt_content_uuid` BEFORE INSERT ON `tt_content`
FOR EACH ROW begin
<?php
/**
* Contains translation tools
*
* @author Kasper Skaarhoj <[email protected]>
* @package TYPO3
* @subpackage tx_l10nmgr
*/
class tx_l10nmgr_tools {
@pumatertion
pumatertion / Mailer.php
Created July 10, 2013 14:13
Mail Service
<?php
namespace BLEICKER\Mailer\Services;
/* *
* This script belongs to the FLOW3 package "BLEICKER.Mailer". *
* *
* */
use TYPO3\FLOW3\Annotations as FLOW3;
@pumatertion
pumatertion / ArticleMetaData.html
Created July 24, 2013 15:15
exception on new element based on supertype: TYPO3.Neos:Content
{namespace neos=TYPO3\Neos\ViewHelpers}
<neos:contentElement node="{node}">
<neos:contentElement.editable property="title">{title -> f:format.raw()}</neos:contentElement.editable>
</neos:contentElement>