Skip to content

Instantly share code, notes, and snippets.

View mooror's full-sized avatar
🚀
Working on our web platform

Benjamin mooror

🚀
Working on our web platform
View GitHub Profile
class YoutubeIdBlogPostExtension extends DataExtension {
private static $db = array(
'YoutubeId' => 'Varchar',
);
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Main", new TextField('YoutubeId','Youtube Video Id'), "Content");
}
}
@mooror
mooror / UseCase.php
Last active August 2, 2016 23:40
First File is the whole color.php file including all code from the original module. The second file is just my Nice function to make it easier for you.
<?php
private static $summary_fields = array (
'Color.Nice' => 'Color'
);
<?php
$newItemVersion = StoreItemVersion::create();
$newItemVersion->ParentItemID = $this->newItemId;
$newItemVersion->Name = $composerJsonArray['version'];
$newItemVersion->FileID = 255;
// $newItemVersion->FileID = $newFile;
$newItemVersion->ModeID = 4;
$newItemVersionId = $newItemVersion->write();
//ModeID works fine but FileID dosn't. Instead I get a 0 for FileID in the database
# The Yaml produced by pyYAML in my python script
---
After:
- framework/*
- cms/*
Name: mysite
---
Debug:
friendly_error_httpcode: true
SSViewer:
@mooror
mooror / BuildConsoleOutput.txt
Created February 2, 2017 23:08
Satis Mirroring Test
# php bin/satis build satis.json web/
Scanning packages
The composer-plugin-api ^1.0 requirement did not match any package
The composer-plugin-api 1.0.0 requirement did not match any package
Creating local downloads in 'web//dist'
Dumping 'composer/installers'.
- Installing composer/installers (v1.0.15)
Downloading: 100%
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@mooror
mooror / CustomDataObject.php
Created August 14, 2017 00:29
SS3 DataObject Permissions Functionality
<?php
class CustomDataObject extends DataObject implements PermissionProvider
{
static $api_access = true;
static $permissionsSuffix = "CUSTOMDATAOBJECT"; // Permission code will be ACTION_SUFFIX
static $permissionsDescriptor = "Custom";
static $permissionsCategory = 'Custom Object';
static $permissionsActionsArray = array('view','edit','delete','create');
@mooror
mooror / snippets.cson
Created February 21, 2018 04:21
A series of php snippets for the Atom editer
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
<?php
/**
* Description
*
* @package silverstripe
* @subpackage mysite
*/
class MealCategory extends DataObject
{
/**
@mooror
mooror / LeftAndMain.php
Created August 27, 2018 01:11
The save method that triggers the green alert box.
<?php
// ...
/**
* Save handler
*
* @param array $data
* @param Form $form
* @return HTTPResponse