Skip to content

Instantly share code, notes, and snippets.

View michalkleiner's full-sized avatar

Michal Kleiner michalkleiner

View GitHub Profile
<?php
namespace Nightjar\SS4UpgradeTasks;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use SilverStripe\Assets\File;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
@adrexia
adrexia / EditorConfig.php
Last active July 15, 2020 22:27
Set up various TinyMCE Editors
<?php
namespace App\Config;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\HTMLEditor\TinyMCEConfig;
class EditorConfig
{
public static function setAllEditors()
Add the following methods to your `Image` subclass to allow SVG uploads via `$has_one` `UploadField`'s and uploads via the Asset Admin.
Hat-tip to https://github.com/restruct/silverstripe-svg-images. All I've done is:
* Removed superfluous SVG template logic
* Called `isSVG()` from everywhere
* Added comments where appropriate
* Put all necessary YML config into one place
YML config:
/**
* Beta
*
* Sibling of netteForms.js "rewritten to jQuery"
* @author Pavel Kučera
* @author David Grudl author of netteForms.js, of the idea and the one who I copied from
*
* Disclaimer: I'm not a javascript programmer, actually I hate javascript, so consider that please if you want to complain about quality of this utility.
*
* Dependencies