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 | |
// nice internal / external link field | |
$fields->replaceField('LinkExteralOrInternal', (SelectionGroup::create( | |
"LinkExteralOrInternal", | |
array( | |
SelectionGroup_Item::create( | |
"external", | |
TextField::create( | |
"ExternalLink", | |
"Externe link" |
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
$set = new TabSet( | |
'test tab set', | |
new Tab( | |
'tab a', | |
TextField::create('TabAContent') | |
), | |
new Tab( | |
'tab b', | |
TextField::create('TabABontent') | |
) |
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 | |
/** | |
* Configure SilverStripe from the _ss_environment.php file. | |
* | |
* Edit this file and rename from _ss_environment.sample.php to _ss_environment.php. | |
* Put "require_once('conf/ConfigureFromEnv.php');" into your _config.php file. | |
* http://doc.silverstripe.org/framework/en/trunk/topics/environment-management | |
*/ |
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
/** | |
* Create default Info Page setup | |
*/ | |
function requireDefaultRecords() { | |
parent::requireDefaultRecords(); | |
// Skip creation of default records | |
if(!self::config()->create_default_pages) return; | |
$infoPage = InfoPage::get()->first(); |
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
// initiate FPDI | |
$pdf = new FPDI(); | |
// add a page | |
$pdf->AddPage('landscape'); | |
// set the source file | |
$pdf->setSourceFile(ASSETS_PATH . '/certificate_template_pdfa.pdf'); | |
// import page 1 |
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
public function onBeforeWrite(){ | |
if(!$this->ID or !$this->ImageID) { | |
$gravatarEmailHash = md5(strtolower($this->Email)); | |
$gravatarURL = "http://www.gravatar.com/avatar/$gravatarEmailHash?d=404"; | |
$headers = get_headers($gravatarURL); | |
if (strpos($headers[0],'200')) { | |
//get the extension of the gravatar image - it will be either jpeg or png - we will need it later |
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
--- | |
Name: customroutes | |
After: framework/routes#coreroutes | |
--- | |
Director: | |
rules: | |
'support': 'SupportPage_Controller' | |
'Search': 'FuseSearch_Controller' |
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
protected function onBeforeWrite() { | |
//Do we have a vimeo video ID? If so, we need to grab the Vimeo thumbnail | |
//...but we only want to do this if either of the following conditions are true: | |
//1) A VimeoVideoID has been entered into the CMS and we don't have a thumbnail yet, or | |
//2) The VimeoVideoID entered has changed since this Article was last saved | |
if(($this->VimeoVideoID && !$this->TutorialCustomThumbnailID) | |
|| (isset($this->original['VimeoVideoID']) && ($this->VimeoVideoID != $this->original['VimeoVideoID']))) { | |
//Let's deal with the exceptional case first. Perhaps the content editor is removing the VimeoVideoID. |
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 | |
/** | |
* Image Extension | |
*/ | |
class ImageExtension extends DataExtension { | |
// Rotated Image - | |
// Some mobile image when uploaded will appear correctly oriented on mobile devices, but when |
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 MyDataObjectAdmin extends ModelAdmin { | |
private static $managed_models = array('MyDataObject'); // Can manage multiple models | |
private static $url_segment = 'my-data-object'; // Linked as /admin/my-data-object/ | |
private static $menu_title = 'My DataObjects'; | |
public function getSearchContext() { |
OlderNewer