@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class SingleColumnBlock extends SHBlock { |
| 4 | - protected static $singular_name = 'Single-column Block'; |
|
| 5 | - protected static $db = array ( |
|
| 6 | - 'Content' => 'HTMLText' |
|
| 7 | - ); |
|
| 4 | + protected static $singular_name = 'Single-column Block'; |
|
| 5 | + protected static $db = array ( |
|
| 6 | + 'Content' => 'HTMLText' |
|
| 7 | + ); |
|
| 8 | 8 | } |
| 9 | 9 | \ No newline at end of file |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class TriColumnBlock extends SHBlock { |
| 4 | - protected static $singular_name = 'Triple-column Block'; |
|
| 5 | - protected static $db = array ( |
|
| 6 | - 'LeftColumn' => 'HTMLText', |
|
| 7 | - 'MiddleColumn' => 'HTMLText', |
|
| 8 | - 'RightColumn' => 'HTMLText' |
|
| 9 | - ); |
|
| 4 | + protected static $singular_name = 'Triple-column Block'; |
|
| 5 | + protected static $db = array ( |
|
| 6 | + 'LeftColumn' => 'HTMLText', |
|
| 7 | + 'MiddleColumn' => 'HTMLText', |
|
| 8 | + 'RightColumn' => 'HTMLText' |
|
| 9 | + ); |
|
| 10 | 10 | } |
| 11 | 11 | \ No newline at end of file |
@@ -4,41 +4,41 @@ |
||
| 4 | 4 | * |
| 5 | 5 | * Left-hand-side tab : Admin Blocks |
| 6 | 6 | * */ |
| 7 | - class BlocksAdmin extends ModelAdmin { |
|
| 8 | - private static $managed_models = array('Block'); |
|
| 9 | - private static $url_segment = 'blocks'; |
|
| 10 | - private static $menu_title = 'Blocks'; |
|
| 11 | - private static $menu_priority = 10; |
|
| 12 | - private static $menu_icon = 'silverstripe-block/images/icon-block.png'; |
|
| 7 | + class BlocksAdmin extends ModelAdmin { |
|
| 8 | + private static $managed_models = array('Block'); |
|
| 9 | + private static $url_segment = 'blocks'; |
|
| 10 | + private static $menu_title = 'Blocks'; |
|
| 11 | + private static $menu_priority = 10; |
|
| 12 | + private static $menu_icon = 'silverstripe-block/images/icon-block.png'; |
|
| 13 | 13 | |
| 14 | - public function getEditForm($id = null, $fields = null) { |
|
| 15 | - $form = parent::getEditForm($id, $fields); |
|
| 14 | + public function getEditForm($id = null, $fields = null) { |
|
| 15 | + $form = parent::getEditForm($id, $fields); |
|
| 16 | 16 | |
| 17 | - $grid = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass)); |
|
| 17 | + $grid = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass)); |
|
| 18 | 18 | |
| 19 | - $grid->getConfig() |
|
| 20 | - ->removeComponentsByType('GridFieldPaginator') |
|
| 21 | - ->removeComponentsByType('GridFieldAddNewButton') |
|
| 22 | - ->removeComponentsByType('GridFieldPrintButton') |
|
| 23 | - ->removeComponentsByType('GridFieldExportButton') |
|
| 24 | - ->addComponents( |
|
| 25 | - new GridFieldPaginatorWithShowAll(30), |
|
| 26 | - $multiClass = new MultiClassSelector(), |
|
| 27 | - $sortable = new GridFieldOrderableRows('SortOrder') |
|
| 28 | - ); |
|
| 19 | + $grid->getConfig() |
|
| 20 | + ->removeComponentsByType('GridFieldPaginator') |
|
| 21 | + ->removeComponentsByType('GridFieldAddNewButton') |
|
| 22 | + ->removeComponentsByType('GridFieldPrintButton') |
|
| 23 | + ->removeComponentsByType('GridFieldExportButton') |
|
| 24 | + ->addComponents( |
|
| 25 | + new GridFieldPaginatorWithShowAll(30), |
|
| 26 | + $multiClass = new MultiClassSelector(), |
|
| 27 | + $sortable = new GridFieldOrderableRows('SortOrder') |
|
| 28 | + ); |
|
| 29 | 29 | |
| 30 | - $subBlocks = ClassInfo::subclassesFor('Block'); |
|
| 31 | - if (is_null($subBlocks)) { |
|
| 32 | - $subBlocks = array('Block'); |
|
| 33 | - }else{ |
|
| 34 | - unset($subBlocks['Block']); |
|
| 35 | - foreach ($subBlocks as $key => &$value) { |
|
| 36 | - $value = empty($key::$singular_name) ? ucwords(trim(strtolower(preg_replace('/_?([A-Z])/', ' $1', $value)))) : $key::$singular_name; |
|
| 37 | - } |
|
| 38 | - } |
|
| 30 | + $subBlocks = ClassInfo::subclassesFor('Block'); |
|
| 31 | + if (is_null($subBlocks)) { |
|
| 32 | + $subBlocks = array('Block'); |
|
| 33 | + }else{ |
|
| 34 | + unset($subBlocks['Block']); |
|
| 35 | + foreach ($subBlocks as $key => &$value) { |
|
| 36 | + $value = empty($key::$singular_name) ? ucwords(trim(strtolower(preg_replace('/_?([A-Z])/', ' $1', $value)))) : $key::$singular_name; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $multiClass->setClasses($subBlocks); |
|
| 41 | - $grid->setTitle('All Blcoks'); |
|
| 42 | - return $form; |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | 40 | \ No newline at end of file |
| 41 | + $multiClass->setClasses($subBlocks); |
|
| 42 | + $grid->setTitle('All Blcoks'); |
|
| 43 | + return $form; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | \ No newline at end of file |