Skip to content

Instantly share code, notes, and snippets.

View bwaidelich's full-sized avatar
🏠
Working from home

Bastian Waidelich bwaidelich

🏠
Working from home
View GitHub Profile
@bwaidelich
bwaidelich / VariantView.php
Created May 24, 2011 12:39
Variant View (for Fluid v1.3+ based on Peter Niederlags version: https://gist.github.com/822613)
<?php
/* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
@bwaidelich
bwaidelich / Template.html
Created August 15, 2011 10:11
localized dates in Fluid
{f:format.date(date: '@{newsdate}', format: 'd.')} <f:translate key="monthNames.{f:format.date(date: '@{newsdate}', format: 'n')}" /> {f:format.date(date: '@{newsdate}', format: 'Y')}
@bwaidelich
bwaidelich / gist:1205824
Created September 9, 2011 09:21
Update electronic address
$electronicAddresses = $person->getElectronicAddresses();
$electronicAddressIndex = $electronicAddresses->indexOf($modifiedElectronicAddress);
$electronicAddresses->set($electronicAddressIndex, $modifiedElectronicAddress);
@bwaidelich
bwaidelich / AbstractBaseController.php
Created October 17, 2011 08:50
FLOW3: Redirect to action based on (sub)domain
<?php
abstract class AbstractBaseController extends ActionController {
/**
* Redirect to specific controller if current subdomain is not equal to the current controller name
* Note: initializeAction() is called before every action by default
*
* @return void
*/
protected function initializeAction() {
@bwaidelich
bwaidelich / Caches.yaml
Created October 20, 2011 12:58
Disable Compilation of Fluid templates
Fluid_TemplateCache:
backend: TYPO3\FLOW3\Cache\Backend\NullBackend
@bwaidelich
bwaidelich / ImageViewHelper.php
Created October 26, 2011 12:21
ImageViewHelper
<?php
namespace Your\Package\ViewHelpers;
use TYPO3\FLOW3\Annotations as FLOW3;
class ImageViewHelper extends \TYPO3\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper {
/**
* @FLOW3\Inject
* @var \TYPO3\FLOW3\Resource\Publishing\ResourcePublisher
@bwaidelich
bwaidelich / AbstractController.php
Created February 24, 2012 09:10
Fluid Interceptors (Replace Tabs by underscores)
<?php
abstract class Tx_BlogExample_Controller_AbstractController extends Tx_Extbase_MVC_Controller_ActionController {
protected $defaultViewObjectName = 'Tx_BlogExample_View_TemplateView';
// ...
}
?>
@bwaidelich
bwaidelich / FormFactory.php
Created March 28, 2012 15:40
Closure Finisher
<?php
// ...
$closureFinisher = new \TYPO3\Form\Finishers\ClosureFinisher();
$closureFinisher->setOption('closure', function($formRuntime) {
// $formRuntime->getFormState()->getFormValues();
});
$formDefinition->addFinisher($closureFinisher);
// ...
?>
<?php
namespace TYPO3\TYPO3\Setup\Step;
/* *
* This script belongs to the FLOW3 package "TYPO3.Setup". *
* *
* 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. *
* *
<?php
class MyFormFactory extends \TYPO3\Form\Factory\AbstractFormFactory {
public function build(array $factorySpecificConfiguration, $presetName) {
$formConfiguration = $this->getPresetConfiguration($presetName);
$form = new FormDefinition('myForm', $formConfiguration);
$page1 = $form->createPage('page1');
$actionSelect = $page1->createElement('actionSelector', 'TYPO3.Form:SingleSelectDropdown');