Completed
Push — master ( 68f946...ae8931 )
by Leo
02:20
created
code/Extensions/BlockinPage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class BlockinPage extends Extension {
3
-	protected static $belongs_many_many = array (
3
+	protected static $belongs_many_many = array(
4 4
 		'Blocks'			=>	'Block'
5 5
 	);
6 6
 	
7
-	public function updateCMSFields( FieldList $fields ) {
7
+	public function updateCMSFields(FieldList $fields) {
8 8
 		$ancestry = ClassInfo::ancestry($this->owner->ClassName);
9 9
 		if (!in_array('RedirectorPage', $ancestry) && !in_array('VirtualPage', $ancestry)) {
10 10
 			$blocks = $this->owner->Blocks();
11
-			$blocks_grid = $this->gridBuilder('Blocks', $blocks, '', true,'GridFieldConfig_RelationEditor');
11
+			$blocks_grid = $this->gridBuilder('Blocks', $blocks, '', true, 'GridFieldConfig_RelationEditor');
12 12
 			$docked_grid = $this->gridBuilder('DockedBlocks', $this->dockedBlocks(), '');
13 13
 			
14 14
 			$fields->addFieldToTab('Root.MyBlocks', $blocks_grid);
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		$grid = new GridField($name, $label, $source);
28 28
 		$config = $gridHeaderType::create();
29 29
 		$config->removeComponentsByType('GridFieldAddNewButton');
30
-		if ( $canAdd ) {
30
+		if ($canAdd) {
31 31
 			$config->addComponents(
32 32
 				$multiClass = new GridFieldAddNewMultiClass(),
33 33
 				$sortable = new GridFieldOrderableRows('SortOrder')
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 			$subBlocks = ClassInfo::subclassesFor('Block');
36 36
 			if (is_null($subBlocks)) {
37 37
 				$subBlocks = array('Block');
38
-			}else{
38
+			} else {
39 39
 				unset($subBlocks['Block']);
40 40
 			}
41 41
 			$multiClass->setClasses($subBlocks);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				$IDs[] = $BlockID;
56 56
 			}
57 57
 		}
58
-		$blocks = Block::get()->filter('ID', $IDs)->sort('SortOrder','ASC');
58
+		$blocks = Block::get()->filter('ID', $IDs)->sort('SortOrder', 'ASC');
59 59
 		return $blocks;
60 60
 	}
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
code/Block.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class Block extends DataObject {
4
-	protected static $db = array (
4
+	protected static $db = array(
5 5
 		'SortOrder'			=>	'Int',
6 6
 		'Title'				=>	'Varchar(64)',
7 7
 		'TitleWrapper'		=>	'Enum("h2,h3,h4,h5,h6")',
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		'addMarginBottom'	=>	'Boolean'
15 15
 	);
16 16
 	
17
-	protected static $many_many = array (
17
+	protected static $many_many = array(
18 18
 		'Pages'				=>	'Page'
19 19
 	);
20 20
 		
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		'MySQLDatabase'		=> 'ENGINE=MyISAM'
23 23
     );
24 24
 	
25
-	protected static $extensions = array (
25
+	protected static $extensions = array(
26 26
 		'StandardPermissions'
27 27
 	);
28 28
 	
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	
43 43
 	public function VisibleTo() {
44 44
 		if (strlen(trim($this->MemberVisibility)) > 0) {
45
-			$lists = 'Group: ' . str_replace(',','<br />Group: ', $this->MemberVisibility);
46
-		}else{
45
+			$lists = 'Group: '.str_replace(',', '<br />Group: ', $this->MemberVisibility);
46
+		} else {
47 47
 			$lists = '<em>&lt;All&gt;</em>';
48 48
 		}
49 49
 		
50
-		return new LiteralField('VisibleTo',$lists);
50
+		return new LiteralField('VisibleTo', $lists);
51 51
 	}
52 52
 	
53 53
 	public function BlockType() {
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 	public function shownOn() {
58 58
 		if ($this->showBlockbyClass) {
59 59
 			if (strlen(trim($this->shownInClass)) > 0) {
60
-				$lists = 'Type: ' . str_replace(',','<br />Type: ', $this->shownInClass);
61
-			}else{
60
+				$lists = 'Type: '.str_replace(',', '<br />Type: ', $this->shownInClass);
61
+			} else {
62 62
 				$lists = '<em>&lt;not assigned&gt;</em>';
63 63
 			}
64
-		}else{
64
+		} else {
65 65
 			if ($this->Pages()->count() > 0) {
66
-				$lists = 'Page: ' . implode('<br />Page: ', $this->Pages()->column('Title'));
67
-			}else{
66
+				$lists = 'Page: '.implode('<br />Page: ', $this->Pages()->column('Title'));
67
+			} else {
68 68
 				$lists = '<em>&lt;not assigned&gt;</em>';
69 69
 			}
70 70
 		}
71
-		return new LiteralField('shownOn',$lists);
71
+		return new LiteralField('shownOn', $lists);
72 72
 	}
73 73
 	
74 74
 	public function getCMSFields() {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$pageSelector = new CheckboxSetField(
123 123
 			$name = "Pages",
124 124
 			$title = "Show on Page(s)",
125
-			$availablePages->map('ID','Title')
125
+			$availablePages->map('ID', 'Title')
126 126
 		);
127 127
 		
128 128
 		
Please login to merge, or discard this patch.