This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$list = SomeObject::get()->toArray(); | |
$singleViewObject = SingleViewObject::create([ | |
'Title' => 'Hello World' | |
]); | |
$result = array_merge($list, [$singleViewObject]); | |
return ArrayList::create($result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Config; | |
use SilverStripe\Core\Manifest\ModuleLoader; | |
use SilverStripe\Forms\HTMLEditor\TinyMCEConfig; | |
class EditorConfig | |
{ | |
public static function setAllEditors() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$editor = HtmlEditorConfig::get('cms'); | |
// Enable template plugin in the WYSIWYG editor// | |
$editor->enablePlugins('template'); | |
$editor->insertButtonsAfter('tablecontrols', 'template'); | |
//Specify location of your snippets// | |
$editor->setOptions(['template_templates'=> [ | |
[ | |
'title'=>'Quote - Text Color', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyDataObject extends DataObject implements PermissionProvider { | |
public function canView($member = NULL, $context = []) { | |
return Permission::check('MYOBJECT_VIEW'); | |
} | |
public function canEdit($member = NULL, $context = []) { | |
return Permission::check('MYOBJECT_EDIT'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private static $has_one = array( | |
'ImagePath' => 'Folder' | |
); | |
// in settings | |
$fields->insertBefore( | |
new TreeDropdownField( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### SILVERSTRIPE START ### | |
<Files *.ss> | |
Order deny,allow | |
Deny from all | |
Allow from 127.0.0.1 | |
</Files> | |
<Files web.config> | |
Order deny,allow | |
Deny from all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$memberMap = Member::get()->map("ID", "FirstName")->toArray(); | |
asort($memberMap); | |
$memberMap = ListboxField::create('Collaborators', singleton('Member')->i18n_plural_name()) | |
->setMultiple(true) | |
->setSource($memberMap) | |
->setAttribute( | |
'data-placeholder', | |
'Collaborators' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* What kind of environment is this: development, test, or live (ie, production)? */ | |
define('SS_ENVIRONMENT_TYPE', 'dev'); | |
/* Database connection */ | |
define('SS_DATABASE_SERVER', '127.0.0.1'); | |
define('SS_DATABASE_USERNAME', 'root'); | |
define('SS_DATABASE_PASSWORD', ''); | |
/* Configure a default username and password to access the CMS on all sites in this environment. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A list decorator that allows a list to be grouped into sub-lists by number. Based on GroupBy functionality | |
* @author Naomi Guyer | |
*/ | |
class SplitList extends SS_ListDecorator { | |
/** | |
* @param string $num | |
* @return array |
NewerOlder