This file contains hidden or 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
// add this to mysite/_config.php | |
Object::useCustomClass('DateField_View_JQuery', 'jQueryUIDateField_View'); | |
// mysite/code/jQueryUIDateField_View.php | |
class jQueryUIDateField_View extends DateField_View_JQuery { | |
function onBeforeRender() { | |
$Field = $this->getField(); | |
$format = self::convert_iso_to_jquery_format($Field->getConfig('dateformat')); | |
$conf = array( | |
'dateFormat' => $format |
This file contains hidden or 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 DaysSliderField extends SliderField { | |
function Value() { | |
$Day = _t("Date.DAY", "day"); | |
$Days = _t("Date.DAYS", "days"); | |
$AndMore = _t('TravelType.AndMore', 'and more'); | |
$values = $this->getConfig('values'); | |
$str = $values[0]; | |
$str .= ($values[0] == 1)?' '.$Day:' '.$Days; |
This file contains hidden or 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 myPage extends Page { | |
public static $has_one = array( | |
'Folder' => 'Folder' | |
); | |
public function getCMSFields() { | |
$fields = parent::getCMSFields(); | |
//$PhotoManager = new ImageDataObjectManager (/* some params here */); |
This file contains hidden or 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 | |
if (class_exists('AssetManager')) DataObjectManager::allow_assets_override(false); // if DOM is installed | |
Object::add_extension('Folder', 'myAssetsFolderDecorator'); | |
if (class_exists('AssetManager')) DataObjectManager::allow_assets_override(true); // if DOM is installed |
This file contains hidden or 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
class Page extends SiteTree { | |
... | |
function Content() { | |
$content = $this->Content; | |
// move class to the beginning right after <img | |
$pattern[0] = '/(<img)([^>]*?)(class=(\'|")([^>]*?)(\'|"))([^>]*?>)/i'; | |
$replacement[0] = '$1 $3$2$7'; | |
// add <a> to all images with class popup and a src having _resampled |
This file contains hidden or 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
@mixin rgba-background($color, $opacity) { | |
$rgba: rgba($color, $opacity); | |
$IEcolor: ie_hex_str($rgba); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{$IEcolor}', endColorstr='#{$IEcolor}', GradientType=0 ); | |
background: $rgba; | |
} |
This file contains hidden or 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 GridFieldPersonSalutationDropDown implements GridField_ColumnProvider, GridField_URLHandler { | |
public function augmentColumns($gridField, &$columns) { | |
$columns[] = 'Salutation'; | |
} | |
public function getColumnsHandled($gridField) { | |
return array('Salutation'); | |
} |
This file contains hidden or 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
/** | |
* Return children from the stage site | |
* | |
* @param showAll Inlcude all of the elements, even those not shown in the menus. | |
* (only applicable when extension is applied to {@link SiteTree}). | |
* @return SS_List | |
*/ | |
public function stageChildren($showAll = false) { | |
$baseClass = ClassInfo::baseDataClass($this->owner->class); |
This file contains hidden or 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
require 'rubygems' | |
version = ">= 0" | |
ARGV.clear | |
ARGV << "compile" | |
path = ".." | |
i = 0 | |
while !File.exists?(File.join(path, "config.rb")) | |
if i > 3 then |
This file contains hidden or 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 MyModelAdmin extends ModelAdmin { | |
private static $managed_models = array('MyDataObject'); | |
private static $url_segment = 'foobar'; | |
} |
OlderNewer