Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Bastian Waidelich bwaidelich

🏠
Working from home
View GitHub Profile
@bwaidelich
bwaidelich / VariantView.php
Created May 24, 2011
Variant View (for Fluid v1.3+ based on Peter Niederlags version: https://gist.github.com/822613)
View VariantView.php
<?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 Aug 15, 2011
localized dates in Fluid
View Template.html
{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 Sep 9, 2011
Update electronic address
View gist:1205824
$electronicAddresses = $person->getElectronicAddresses();
$electronicAddressIndex = $electronicAddresses->indexOf($modifiedElectronicAddress);
$electronicAddresses->set($electronicAddressIndex, $modifiedElectronicAddress);
@bwaidelich
bwaidelich / AbstractBaseController.php
Created Oct 17, 2011
FLOW3: Redirect to action based on (sub)domain
View AbstractBaseController.php
<?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 Oct 20, 2011
Disable Compilation of Fluid templates
View Caches.yaml
Fluid_TemplateCache:
backend: TYPO3\FLOW3\Cache\Backend\NullBackend
View ImageViewHelper.php
<?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 Feb 24, 2012
Fluid Interceptors (Replace Tabs by underscores)
View AbstractController.php
<?php
abstract class Tx_BlogExample_Controller_AbstractController extends Tx_Extbase_MVC_Controller_ActionController {
protected $defaultViewObjectName = 'Tx_BlogExample_View_TemplateView';
// ...
}
?>
View FormFactory.php
<?php
// ...
$closureFinisher = new \TYPO3\Form\Finishers\ClosureFinisher();
$closureFinisher->setOption('closure', function($formRuntime) {
// $formRuntime->getFormState()->getFormValues();
});
$formDefinition->addFinisher($closureFinisher);
// ...
?>
View gist:2228357
<?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. *
* *
View MyFormFactory.php
<?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');
You can’t perform that action at this time.