Skip to content

Instantly share code, notes, and snippets.


zanderwar zanderwar

View GitHub Profile
zanderwar / DataObjectLinkTracking.php
Last active January 31, 2018 04:30
Just in case someone else wants to use HTMLText in DataObjects and be able to publish the images that clients can upload into TinyMCE - SilverStripe 4
View DataObjectLinkTracking.php
namespace Vulcan\Common\Traits;
use SilverStripe\Assets\File;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\HasManyList;
* Trait DataObjectLinkTracking
zanderwar / Page.php
Created January 20, 2018 03:18
Easier requirements for SilverStripe 4
View Page.php
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Model\SiteTree;
* Class Page
class Page extends SiteTree
zanderwar / AbstractApiController.php
Created October 15, 2017 06:41
Just a simple API output controller for SilverStripe 4
View AbstractApiController.php
namespace Zanderwar\Api\Controllers;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert;
zanderwar / ModifyModelAdminGridFieldConfig.php
Created June 9, 2017 12:49
An example of swapping the GridFieldConfig of a particular GridField in a ModelAdmin
View ModifyModelAdminGridFieldConfig.php
class Example extends ModelAdmin
private static $url_segment = 'Example';
private static $menu_title = 'Example';
private static $managed_models = [
zanderwar / PopulateFormDefaults.php
Last active June 14, 2017 04:43
Populates a SilverStripe Form subclass with DataObject values
View PopulateFormDefaults.php
class MyForm extends Form
* @param Customer $customer
* @return $this
public function setObject(DataObject $object)
View ips-thumbnails.html
<img src='' class='ipsThumb'/>
<img src='' class='ipsThumb ipsThumb_large'/>
<img src='' class='ipsThumb ipsThumb_medium'/>
<img src='' class='ipsThumb ipsThumb_small'/>
<img src='' class='ipsThumb ipsThumb_tiny'/>
View ips-message-alerts.html
<div class='ipsMessage ipsMessage_info'><strong>Information:</strong> Look behind you!</div>
<div class='ipsMessage ipsMessage_error'><strong>Danger:</strong> Seriously..... Look behind you!</div>
<div class='ipsMessage ipsMessage_warning'><strong>Warning:</strong> Is that a robot?!? Be careful it bites!</div>
<div class='ipsMessage ipsMessage_success'><strong>Success:</strong> Wow where did you get that rocket launcher! *BOOM*</div>
<div class='ipsMessage ipsMessage_general'><strong>General:</strong> Yay it has powered down. Thank god no one got hurt!</div>
View ipb4-tags-badges-example.html
<!-- TAGS -->
<span class='ipsTag_prefix'>I am a tag</span>
<div class='ipsTag_prefix'><span>I am another tag</span></div>
<div class='ipsTag_prefix'><span>I am the tag everybody speaks of!</span></div>
<!-- BADGES -->
<span class='ipsBadge ipsBadge_warning ipsBadge_large'>WARNING BADGE</span>
<span class='ipsBadge ipsBadge_positive ipsBadge_large'>POSITIVE BADGE</span>
<span class='ipsBadge ipsBadge_negative ipsBadge_large'>NEGATIVE BADGE</span>
<span class='ipsBadge ipsBadge_neutral ipsBadge_large'>NEUTRAL BADGE</span>
View ipb4-grid-example.html
<div class='ipsGrid'>
<div class='ipsGrid_span4'>span4</div>
<div class='ipsGrid_span3'>span3</div>
<div class='ipsGrid_span5'>span5</div>
View ipb4-buttons-example.html
<button type='button' class='ipsButton'>Default</button>
<button type='button' class='ipsButton ipsButton_important'>Important</button>
<button type='button' class='ipsButton ipsButton_primary'>Primary</button>
<button type='button' class='ipsButton ipsButton_alternate'>Alternate</button>
<button type='button' class='ipsButton ipsButton_positive'>Positive</button>
<button type='button' class='ipsButton ipsButton_intermediate'>Intermediate</button>
<button type='button' class='ipsButton ipsButton_negative'>Negative</button>
<button type='button' class='ipsButton ipsButton_verylight'>Very Light</button>
<button type='button' class='ipsButton ipsButton_overlaid'>Overlaid</button>
<button type='button' class='ipsButton ipsButton_link'>Link</button>