@@ -5,51 +5,51 @@ |
||
5 | 5 | * Left-hand-side tab : Admin Blocks |
6 | 6 | * */ |
7 | 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'; |
|
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 | 19 | |
20 | - $grid->getConfig() |
|
21 | - ->removeComponentsByType('GridFieldPaginator') |
|
22 | - ->removeComponentsByType('GridFieldAddNewButton') |
|
23 | - ->removeComponentsByType('GridFieldPrintButton') |
|
24 | - ->removeComponentsByType('GridFieldExportButton') |
|
25 | - ->addComponents( |
|
26 | - new GridFieldPaginatorWithShowAll(30), |
|
27 | - $multiClass = new MultiClassSelector(), |
|
28 | - $sortable = new GridFieldOrderableRows('SortOrder') |
|
29 | - ); |
|
20 | + $grid->getConfig() |
|
21 | + ->removeComponentsByType('GridFieldPaginator') |
|
22 | + ->removeComponentsByType('GridFieldAddNewButton') |
|
23 | + ->removeComponentsByType('GridFieldPrintButton') |
|
24 | + ->removeComponentsByType('GridFieldExportButton') |
|
25 | + ->addComponents( |
|
26 | + new GridFieldPaginatorWithShowAll(30), |
|
27 | + $multiClass = new MultiClassSelector(), |
|
28 | + $sortable = new GridFieldOrderableRows('SortOrder') |
|
29 | + ); |
|
30 | 30 | |
31 | - $subBlocks = self::getAvaiableTypes(); |
|
32 | - $multiClass->setClasses($subBlocks); |
|
33 | - $grid->setTitle('All Blcoks'); |
|
34 | - return $form; |
|
35 | - } |
|
31 | + $subBlocks = self::getAvaiableTypes(); |
|
32 | + $multiClass->setClasses($subBlocks); |
|
33 | + $grid->setTitle('All Blcoks'); |
|
34 | + return $form; |
|
35 | + } |
|
36 | 36 | |
37 | - public static function getAvaiableTypes() { |
|
38 | - $subBlocks = ClassInfo::subclassesFor('Block'); |
|
39 | - if (is_null($subBlocks)) { |
|
40 | - $subBlocks = array('Block'); |
|
41 | - }else{ |
|
42 | - $disabledTypes = Config::inst()->get('Block','DisabledBlocks'); |
|
43 | - if (!empty($disabledTypes)) { |
|
44 | - foreach ($disabledTypes as $disabledType) { |
|
45 | - unset($subBlocks[$disabledType]); |
|
46 | - } |
|
47 | - } |
|
48 | - foreach ($subBlocks as $key => &$value) { |
|
49 | - $value = empty($key::$singular_name) ? ucwords(trim(strtolower(preg_replace('/_?([A-Z])/', ' $1', $value)))) : $key::$singular_name; |
|
50 | - } |
|
51 | - } |
|
37 | + public static function getAvaiableTypes() { |
|
38 | + $subBlocks = ClassInfo::subclassesFor('Block'); |
|
39 | + if (is_null($subBlocks)) { |
|
40 | + $subBlocks = array('Block'); |
|
41 | + }else{ |
|
42 | + $disabledTypes = Config::inst()->get('Block','DisabledBlocks'); |
|
43 | + if (!empty($disabledTypes)) { |
|
44 | + foreach ($disabledTypes as $disabledType) { |
|
45 | + unset($subBlocks[$disabledType]); |
|
46 | + } |
|
47 | + } |
|
48 | + foreach ($subBlocks as $key => &$value) { |
|
49 | + $value = empty($key::$singular_name) ? ucwords(trim(strtolower(preg_replace('/_?([A-Z])/', ' $1', $value)))) : $key::$singular_name; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - return $subBlocks; |
|
54 | - } |
|
53 | + return $subBlocks; |
|
54 | + } |
|
55 | 55 | } |