Skip to content

Instantly share code, notes, and snippets.

View unclecheese's full-sized avatar

Aaron Carlino unclecheese

View GitHub Profile
<?php
class ModelAdminFilteredViewExtension extends DataExtension
{
public function updateList(SS_List &$list)
{
$list = $list->filter($this->getFilters());
}
<?php
namespace MyProject;
use SilverStripe\GraphQL\Schema\Field\Query;
use SilverStripe\GraphQL\Schema\Interfaces\QueryPlugin;
use SilverStripe\GraphQL\Schema\Interfaces\SchemaUpdater;
use SilverStripe\GraphQL\Schema\Schema;
@unclecheese
unclecheese / cow-compare.php
Created September 23, 2019 02:07
Generates Github compare links between two given tags of a silverstripe module
#!/usr/bin/env php
<?php
$path = isset($argv[1]) ? $argv[1] : './';
$isMinor = isset($argv[2]) && $argv[2] === '-m';
$path = rtrim($path, '/') . '/';
$lockFile = $path . 'composer.lock';
if (!file_exists($lockFile)) {
<?php
namespace SilverStripe\Bambusa\Extensions;
use JonoM\BetterNavigator\Extension\BetterNavigatorExtension;
use SilverStripe\ORM\Extension;
use SilverStripe\ORM\FieldType\DBHTMLText;
<?php
namespace SilverStripe\Snapshots;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\ORM\Connect\Query;
use SilverStripe\ORM\Limitable;
use SilverStripe\ORM\Queries\SQLSelect;
<?php
namespace SilverStripe\GraphQL\Scaffolding\Scaffolders\CRUD;
use Exception;
use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\ResolveInfo;
use SilverStripe\Core\ClassInfo;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\OperationResolver;
<?php
class GridFieldRegistry
{
public function add($identifier, GridField $gridField)
{
if ($identifierIsNotUnique) { throw... }
$this->registry[] = new GridFieldRegistration(
$identifier,
@unclecheese
unclecheese / Page_Controller.php
Created October 28, 2017 22:17
SS ajax site search
<?php
class Page_Controller extends ContentController
{
public function init()
{
parent::init();
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
Requirements::javascript('themes/simple/javascript/script.js');
}
<?php
class YourPage extends Page
{
private static $has_one = [
'Slideshow1' => 'Image',
'Slideshow2' => 'Image',
// etc..
];
<?php
class GraphQLScaffolder
{
const READ
const UPDATE
const DELETE
const CREATE
/**