Skip to content

Instantly share code, notes, and snippets.

@Zauberfisch
Zauberfisch / TranslatableControllerExtension.php
Last active December 23, 2015 13:41
SilverStripe Translatable defaults snippets
<?php
// file: mysite/code/TranslatableControllerExtension.php
class TranslatableControllerExtension extends Extension {
/**
* save the current controller to ensure we have access to it,
* this is necessary because Security crates a fake Page_Controller to render templates
* @var Controller
*/
protected static $actual_current_controller;
<?php
namespace App\Extensions;
class BaseElementExtension extends Extension
{
/**
* Flag to indiciate if this element is a new element. Used because isChanged('ID') seems to be unreliable
*
* @var bool