Completed
Push — master ( 36ca99...9a605b )
by Jason
02:58
created
code/SlideImage.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -2,95 +2,95 @@
 block discarded – undo
2 2
 
3 3
 class SlideImage extends DataObject implements PermissionProvider
4 4
 {
5
-    //TODO: move to config.yml
6
-    private static $defaults = array(
7
-        'ShowSlide' => true,
8
-    );
5
+	//TODO: move to config.yml
6
+	private static $defaults = array(
7
+		'ShowSlide' => true,
8
+	);
9 9
 
10
-    public function getCMSFields()
11
-    {
12
-        $fields = parent::getCMSFields();
13
-        $ImageField = new UploadField('Image', 'Image');
14
-        $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
15
-        $ImageField->setFolderName('Uploads/SlideImages');
16
-        $ImageField->setConfig('allowedMaxFileNumber', 1);
17
-        $ImageField->getValidator()->setAllowedMaxFileSize(FLEXSLIDER_IMAGE_FILE_SIZE_LIMIT);
10
+	public function getCMSFields()
11
+	{
12
+		$fields = parent::getCMSFields();
13
+		$ImageField = new UploadField('Image', 'Image');
14
+		$ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
15
+		$ImageField->setFolderName('Uploads/SlideImages');
16
+		$ImageField->setConfig('allowedMaxFileNumber', 1);
17
+		$ImageField->getValidator()->setAllowedMaxFileSize(FLEXSLIDER_IMAGE_FILE_SIZE_LIMIT);
18 18
 
19
-        $fields->removeByName(array('ShowSlide'));
19
+		$fields->removeByName(array('ShowSlide'));
20 20
 
21
-        $fields->addFieldsToTab('Root.Main', array(
22
-            TextField::create('Name')
23
-                ->setDescription('for internal reference only'),
24
-            TextField::create('Title')
25
-                ->setDescription('optional, used in template'),
26
-            TextareaField::create('Description')
27
-                ->setDescription('optional, used in template'),
28
-            TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'),
29
-            $ImageField,
30
-            CheckboxField::create('ShowSlide')->setTitle('Show Slide')
31
-                ->setDescription('Include this slide in the slider. Uncheck to hide'),
32
-        ));
33
-        $fields->removeByName(array(
34
-            'SortOrder',
35
-            'PageID',
36
-        ));
21
+		$fields->addFieldsToTab('Root.Main', array(
22
+			TextField::create('Name')
23
+				->setDescription('for internal reference only'),
24
+			TextField::create('Title')
25
+				->setDescription('optional, used in template'),
26
+			TextareaField::create('Description')
27
+				->setDescription('optional, used in template'),
28
+			TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'),
29
+			$ImageField,
30
+			CheckboxField::create('ShowSlide')->setTitle('Show Slide')
31
+				->setDescription('Include this slide in the slider. Uncheck to hide'),
32
+		));
33
+		$fields->removeByName(array(
34
+			'SortOrder',
35
+			'PageID',
36
+		));
37 37
 
38
-        $this->extend('updateCMSFields', $fields);
38
+		$this->extend('updateCMSFields', $fields);
39 39
 
40
-        return $fields;
41
-    }
40
+		return $fields;
41
+	}
42 42
 
43
-    public function validate()
44
-    {
45
-        $result = parent::validate();
43
+	public function validate()
44
+	{
45
+		$result = parent::validate();
46 46
 
47
-        if (!$this->Name) {
48
-            $result->error('A Name is required before you can save');
49
-        }
47
+		if (!$this->Name) {
48
+			$result->error('A Name is required before you can save');
49
+		}
50 50
 
51
-        if (!$this->ImageID) {
52
-            $result->error('An Image is required before you can save');
53
-        }
51
+		if (!$this->ImageID) {
52
+			$result->error('An Image is required before you can save');
53
+		}
54 54
 
55
-        return $result;
56
-    }
55
+		return $result;
56
+	}
57 57
 
58
-    public function Thumbnail()
59
-    {
60
-        return $this->Image()->CroppedImage(80, 80);
61
-    }
58
+	public function Thumbnail()
59
+	{
60
+		return $this->Image()->CroppedImage(80, 80);
61
+	}
62 62
 
63
-    public function Large()
64
-    {
65
-        if ($this->Image()->GetHeight() > 700) {
66
-            return $this->Image()->SetHeight(700);
67
-        } else {
68
-            return $this->Image();
69
-        }
70
-    }
63
+	public function Large()
64
+	{
65
+		if ($this->Image()->GetHeight() > 700) {
66
+			return $this->Image()->SetHeight(700);
67
+		} else {
68
+			return $this->Image();
69
+		}
70
+	}
71 71
 
72
-    public function providePermissions()
73
-    {
74
-        return array(
75
-            'Slide_EDIT' => 'Edit a Slide',
76
-            'Slide_DELETE' => 'Delete a Slide',
77
-            'Slide_CREATE' => 'Create a Slide',
78
-        );
79
-    }
80
-    public function canCreate($member = null)
81
-    {
82
-        return Permission::check('Slide_CREATE');
83
-    }
84
-    public function canEdit($member = null)
85
-    {
86
-        return Permission::check('Slide_EDIT');
87
-    }
88
-    public function canDelete($member = null)
89
-    {
90
-        return Permission::check('Slide_DELETE');
91
-    }
92
-    public function canView($member = null)
93
-    {
94
-        return true;
95
-    }
72
+	public function providePermissions()
73
+	{
74
+		return array(
75
+			'Slide_EDIT' => 'Edit a Slide',
76
+			'Slide_DELETE' => 'Delete a Slide',
77
+			'Slide_CREATE' => 'Create a Slide',
78
+		);
79
+	}
80
+	public function canCreate($member = null)
81
+	{
82
+		return Permission::check('Slide_CREATE');
83
+	}
84
+	public function canEdit($member = null)
85
+	{
86
+		return Permission::check('Slide_EDIT');
87
+	}
88
+	public function canDelete($member = null)
89
+	{
90
+		return Permission::check('Slide_DELETE');
91
+	}
92
+	public function canView($member = null)
93
+	{
94
+		return true;
95
+	}
96 96
 }
Please login to merge, or discard this patch.