Passed
Pull Request — master (#27)
by Robbie
02:21
created
tests/Extensions/WorkflowDefinitionExtensionTest.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -15,34 +15,34 @@
 block discarded – undo
15 15
 class WorkflowDefinitionExtensionTest extends FunctionalTest
16 16
 {
17 17
 
18
-    /**
19
-     * @var Boolean If set to TRUE, this will force a test database to be generated
20
-     * in {@link setUp()}. Note that this flag is overruled by the presence of a
21
-     * {@link $fixture_file}, which always forces a database build.
22
-     */
23
-    protected $usesDatabase = true;
18
+	/**
19
+	 * @var Boolean If set to TRUE, this will force a test database to be generated
20
+	 * in {@link setUp()}. Note that this flag is overruled by the presence of a
21
+	 * {@link $fixture_file}, which always forces a database build.
22
+	 */
23
+	protected $usesDatabase = true;
24 24
 
25
-    /**
26
-     * Tests the config option that controls the creation of a default workflow definition
27
-     *
28
-     * @return void
29
-     */
30
-    public function testCreateDefaultWorkflowTest()
31
-    {
32
-        DB::quiet();
25
+	/**
26
+	 * Tests the config option that controls the creation of a default workflow definition
27
+	 *
28
+	 * @return void
29
+	 */
30
+	public function testCreateDefaultWorkflowTest()
31
+	{
32
+		DB::quiet();
33 33
 
34
-        // test disabling the default workflow definition
35
-        Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', false);
36
-        $workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class);
37
-        $workflowExtn->requireDefaultRecords();
38
-        $definition = WorkflowDefinition::get()->first();
39
-        $this->assertNull($definition);
34
+		// test disabling the default workflow definition
35
+		Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', false);
36
+		$workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class);
37
+		$workflowExtn->requireDefaultRecords();
38
+		$definition = WorkflowDefinition::get()->first();
39
+		$this->assertNull($definition);
40 40
 
41
-        // test enabling the default workflow definition
42
-        Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', true);
43
-        $workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class);
44
-        $workflowExtn->requireDefaultRecords();
45
-        $definition = WorkflowDefinition::get()->first();
46
-        $this->assertNotNull($definition);
47
-    }
41
+		// test enabling the default workflow definition
42
+		Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', true);
43
+		$workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class);
44
+		$workflowExtn->requireDefaultRecords();
45
+		$definition = WorkflowDefinition::get()->first();
46
+		$this->assertNotNull($definition);
47
+	}
48 48
 }
Please login to merge, or discard this patch.
src/PageTypes/NewsHolderController.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@
 block discarded – undo
7 7
 
8 8
 class NewsHolderController extends DatedUpdateHolderController
9 9
 {
10
-    private static $allowed_actions = [
11
-        'rss',
12
-        'atom',
13
-    ];
10
+	private static $allowed_actions = [
11
+		'rss',
12
+		'atom',
13
+	];
14 14
 
15
-    public function rss()
16
-    {
17
-        $rss = RSSFeed::create(
18
-            $this->Updates()->sort('Created DESC')->limit(20),
19
-            $this->Link('rss'),
20
-            $this->getSubscriptionTitle()
21
-        );
22
-        $rss->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_rss');
23
-        return $rss->outputToBrowser();
24
-    }
15
+	public function rss()
16
+	{
17
+		$rss = RSSFeed::create(
18
+			$this->Updates()->sort('Created DESC')->limit(20),
19
+			$this->Link('rss'),
20
+			$this->getSubscriptionTitle()
21
+		);
22
+		$rss->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_rss');
23
+		return $rss->outputToBrowser();
24
+	}
25 25
 
26
-    public function atom()
27
-    {
28
-        $atom = CwpAtomFeed::create(
29
-            $this->Updates()->sort('Created DESC')->limit(20),
30
-            $this->Link('atom'),
31
-            $this->getSubscriptionTitle()
32
-        );
33
-        $atom->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_atom');
34
-        return $atom->outputToBrowser();
35
-    }
26
+	public function atom()
27
+	{
28
+		$atom = CwpAtomFeed::create(
29
+			$this->Updates()->sort('Created DESC')->limit(20),
30
+			$this->Link('atom'),
31
+			$this->getSubscriptionTitle()
32
+		);
33
+		$atom->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_atom');
34
+		return $atom->outputToBrowser();
35
+	}
36 36
 }
Please login to merge, or discard this patch.
src/Model/QuickLink.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -11,120 +11,120 @@
 block discarded – undo
11 11
 
12 12
 class Quicklink extends DataObject
13 13
 {
14
-    private static $db = [
15
-        'Name' => 'Varchar(255)',
16
-        'ExternalLink' => 'Varchar(255)',
17
-        'SortOrder' => 'Int',
18
-    ];
19
-
20
-    private static $has_one = [
21
-        'Parent' => BaseHomePage::class,
22
-        'InternalLink' => SiteTree::class,
23
-    ];
24
-
25
-    private static $summary_fields = [
26
-        'Name' => 'Name',
27
-        'InternalLink.Title' => 'Internal Link',
28
-        'ExternalLink' => 'External Link',
29
-    ];
30
-
31
-    private static $table_name = 'Quicklink';
32
-
33
-    public function fieldLabels($includerelations = true)
34
-    {
35
-        $labels = parent::fieldLabels($includerelations);
36
-        $labels['Name'] = _t(__CLASS__ . '.NameLabel', 'Name');
37
-        $labels['ExternalLink'] = _t(__CLASS__ . '.ExternalLinkLabel', 'External Link');
38
-        $labels['SortOrder'] = _t(__CLASS__ . '.SortOrderLabel', 'Sort Order');
39
-        $labels['ParentID'] = _t(__CLASS__ . '.ParentRelationLabel', 'Parent');
40
-        $labels['InternalLinkID'] = _t(__CLASS__ . '.InternalLinkLabel', 'Internal Link');
41
-
42
-        return $labels;
43
-    }
44
-
45
-    public function getLink()
46
-    {
47
-        if ($this->ExternalLink) {
48
-            $url = parse_url($this->ExternalLink);
49
-
50
-            // if no scheme set in the link, default to http
51
-            if (!isset($url['scheme'])) {
52
-                return 'http://' . $this->ExternalLink;
53
-            }
54
-
55
-            return $this->ExternalLink;
56
-        } elseif ($this->InternalLinkID) {
57
-            return $this->InternalLink()->Link();
58
-        }
59
-    }
60
-
61
-    public function canCreate($member = null, $context = [])
62
-    {
63
-        return $this->Parent()->canCreate($member, $context);
64
-    }
65
-
66
-    public function canEdit($member = null)
67
-    {
68
-        return $this->Parent()->canEdit($member);
69
-    }
70
-
71
-    public function canDelete($member = null)
72
-    {
73
-        return $this->Parent()->canDelete($member);
74
-    }
75
-
76
-    public function canView($member = null)
77
-    {
78
-        return $this->Parent()->canView($member);
79
-    }
80
-
81
-    public function getCMSFields()
82
-    {
83
-        $fields = parent::getCMSFields();
84
-
85
-        $fields->removeByName('ParentID');
86
-
87
-        $externalLinkField = $fields->fieldByName('Root.Main.ExternalLink');
88
-
89
-        $fields->removeByName('ExternalLink');
90
-        $fields->removeByName('InternalLinkID');
91
-        $fields->removeByName('SortOrder');
92
-        $externalLinkField->addExtraClass('noBorder');
93
-
94
-        $fields->addFieldToTab('Root.Main', CompositeField::create(
95
-            array(
96
-                TreeDropdownField::create(
97
-                    'InternalLinkID',
98
-                    $this->fieldLabel('InternalLinkID'),
99
-                    SiteTree::class
100
-                ),
101
-                $externalLinkField,
102
-                $wrap = CompositeField::create(
103
-                    $extraLabel = LiteralField::create(
104
-                        'NoteOverride',
105
-                        _t(
106
-                            __CLASS__ . '.Note',
107
-                            // @todo remove the HTML from this translation
108
-                            '<div class="message good notice">Note:  If you specify an External Link, '
109
-                            . 'the Internal Link will be ignored.</div>'
110
-                        )
111
-                    )
112
-                )
113
-            )
114
-        ));
115
-        $fields->insertBefore(
116
-            'Name',
117
-            LiteralField::create(
118
-                'Note',
119
-                _t(
120
-                    __CLASS__ . '.Note2',
121
-                    // @todo remove the HTML from this translation
122
-                    '<p>Use this to specify a link to a page either on this site '
123
-                    . '(Internal Link) or another site (External Link).</p>'
124
-                )
125
-            )
126
-        );
127
-
128
-        return $fields;
129
-    }
14
+	private static $db = [
15
+		'Name' => 'Varchar(255)',
16
+		'ExternalLink' => 'Varchar(255)',
17
+		'SortOrder' => 'Int',
18
+	];
19
+
20
+	private static $has_one = [
21
+		'Parent' => BaseHomePage::class,
22
+		'InternalLink' => SiteTree::class,
23
+	];
24
+
25
+	private static $summary_fields = [
26
+		'Name' => 'Name',
27
+		'InternalLink.Title' => 'Internal Link',
28
+		'ExternalLink' => 'External Link',
29
+	];
30
+
31
+	private static $table_name = 'Quicklink';
32
+
33
+	public function fieldLabels($includerelations = true)
34
+	{
35
+		$labels = parent::fieldLabels($includerelations);
36
+		$labels['Name'] = _t(__CLASS__ . '.NameLabel', 'Name');
37
+		$labels['ExternalLink'] = _t(__CLASS__ . '.ExternalLinkLabel', 'External Link');
38
+		$labels['SortOrder'] = _t(__CLASS__ . '.SortOrderLabel', 'Sort Order');
39
+		$labels['ParentID'] = _t(__CLASS__ . '.ParentRelationLabel', 'Parent');
40
+		$labels['InternalLinkID'] = _t(__CLASS__ . '.InternalLinkLabel', 'Internal Link');
41
+
42
+		return $labels;
43
+	}
44
+
45
+	public function getLink()
46
+	{
47
+		if ($this->ExternalLink) {
48
+			$url = parse_url($this->ExternalLink);
49
+
50
+			// if no scheme set in the link, default to http
51
+			if (!isset($url['scheme'])) {
52
+				return 'http://' . $this->ExternalLink;
53
+			}
54
+
55
+			return $this->ExternalLink;
56
+		} elseif ($this->InternalLinkID) {
57
+			return $this->InternalLink()->Link();
58
+		}
59
+	}
60
+
61
+	public function canCreate($member = null, $context = [])
62
+	{
63
+		return $this->Parent()->canCreate($member, $context);
64
+	}
65
+
66
+	public function canEdit($member = null)
67
+	{
68
+		return $this->Parent()->canEdit($member);
69
+	}
70
+
71
+	public function canDelete($member = null)
72
+	{
73
+		return $this->Parent()->canDelete($member);
74
+	}
75
+
76
+	public function canView($member = null)
77
+	{
78
+		return $this->Parent()->canView($member);
79
+	}
80
+
81
+	public function getCMSFields()
82
+	{
83
+		$fields = parent::getCMSFields();
84
+
85
+		$fields->removeByName('ParentID');
86
+
87
+		$externalLinkField = $fields->fieldByName('Root.Main.ExternalLink');
88
+
89
+		$fields->removeByName('ExternalLink');
90
+		$fields->removeByName('InternalLinkID');
91
+		$fields->removeByName('SortOrder');
92
+		$externalLinkField->addExtraClass('noBorder');
93
+
94
+		$fields->addFieldToTab('Root.Main', CompositeField::create(
95
+			array(
96
+				TreeDropdownField::create(
97
+					'InternalLinkID',
98
+					$this->fieldLabel('InternalLinkID'),
99
+					SiteTree::class
100
+				),
101
+				$externalLinkField,
102
+				$wrap = CompositeField::create(
103
+					$extraLabel = LiteralField::create(
104
+						'NoteOverride',
105
+						_t(
106
+							__CLASS__ . '.Note',
107
+							// @todo remove the HTML from this translation
108
+							'<div class="message good notice">Note:  If you specify an External Link, '
109
+							. 'the Internal Link will be ignored.</div>'
110
+						)
111
+					)
112
+				)
113
+			)
114
+		));
115
+		$fields->insertBefore(
116
+			'Name',
117
+			LiteralField::create(
118
+				'Note',
119
+				_t(
120
+					__CLASS__ . '.Note2',
121
+					// @todo remove the HTML from this translation
122
+					'<p>Use this to specify a link to a page either on this site '
123
+					. '(Internal Link) or another site (External Link).</p>'
124
+				)
125
+			)
126
+		);
127
+
128
+		return $fields;
129
+	}
130 130
 }
Please login to merge, or discard this patch.
src/Extensions/CustomSiteConfig.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,55 +11,55 @@
 block discarded – undo
11 11
  */
12 12
 class CustomSiteConfig extends DataExtension
13 13
 {
14
-    private static $db = array(
15
-        'GACode' => 'Varchar(16)',
16
-        'FacebookURL' => 'Varchar(256)', // multitude of ways to link to Facebook accounts, best to leave it open.
17
-        'TwitterUsername' => 'Varchar(16)', // max length of Twitter username 15
18
-    );
14
+	private static $db = array(
15
+		'GACode' => 'Varchar(16)',
16
+		'FacebookURL' => 'Varchar(256)', // multitude of ways to link to Facebook accounts, best to leave it open.
17
+		'TwitterUsername' => 'Varchar(16)', // max length of Twitter username 15
18
+	);
19 19
 
20
-    public function updateCMSFields(FieldList $fields)
21
-    {
22
-        $fields->addFieldToTab(
23
-            'Root.Main',
24
-            $gaCode = TextField::create(
25
-                'GACode',
26
-                _t(__CLASS__ . '.GaField', 'Google Analytics account')
27
-            )
28
-        );
20
+	public function updateCMSFields(FieldList $fields)
21
+	{
22
+		$fields->addFieldToTab(
23
+			'Root.Main',
24
+			$gaCode = TextField::create(
25
+				'GACode',
26
+				_t(__CLASS__ . '.GaField', 'Google Analytics account')
27
+			)
28
+		);
29 29
 
30
-        $gaCode->setRightTitle(
31
-            _t(
32
-                __CLASS__ . '.GaFieldDesc',
33
-                'Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)'
34
-            )
35
-        );
30
+		$gaCode->setRightTitle(
31
+			_t(
32
+				__CLASS__ . '.GaFieldDesc',
33
+				'Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)'
34
+			)
35
+		);
36 36
 
37
-        $fields->findOrMakeTab('Root.SocialMedia', _t(__CLASS__ . '.SocialMediaTab', 'Social Media'));
37
+		$fields->findOrMakeTab('Root.SocialMedia', _t(__CLASS__ . '.SocialMediaTab', 'Social Media'));
38 38
 
39
-        $fields->addFieldToTab(
40
-            'Root.SocialMedia',
41
-            $facebookURL = TextField::create(
42
-                'FacebookURL',
43
-                _t(__CLASS__ . '.FbField', 'Facebook UID or username')
44
-            )
45
-        );
46
-        $facebookURL->setRightTitle(
47
-            _t(
48
-                __CLASS__ . '.FbFieldDesc',
49
-                'Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/'
50
-                . '<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)'
51
-            )
52
-        );
39
+		$fields->addFieldToTab(
40
+			'Root.SocialMedia',
41
+			$facebookURL = TextField::create(
42
+				'FacebookURL',
43
+				_t(__CLASS__ . '.FbField', 'Facebook UID or username')
44
+			)
45
+		);
46
+		$facebookURL->setRightTitle(
47
+			_t(
48
+				__CLASS__ . '.FbFieldDesc',
49
+				'Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/'
50
+				. '<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)'
51
+			)
52
+		);
53 53
 
54
-        $fields->addFieldToTab(
55
-            'Root.SocialMedia',
56
-            $twitterUsername = TextField::create(
57
-                'TwitterUsername',
58
-                _t(__CLASS__ . '.TwitterField', 'Twitter username')
59
-            )
60
-        );
61
-        $twitterUsername->setRightTitle(
62
-            _t(__CLASS__ . '.TwitterFieldDesc', 'Twitter username (eg, http://twitter.com/<strong>username</strong>)')
63
-        );
64
-    }
54
+		$fields->addFieldToTab(
55
+			'Root.SocialMedia',
56
+			$twitterUsername = TextField::create(
57
+				'TwitterUsername',
58
+				_t(__CLASS__ . '.TwitterField', 'Twitter username')
59
+			)
60
+		);
61
+		$twitterUsername->setRightTitle(
62
+			_t(__CLASS__ . '.TwitterFieldDesc', 'Twitter username (eg, http://twitter.com/<strong>username</strong>)')
63
+		);
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/Extensions/CwpCommentingExtension.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
  */
14 14
 class CwpCommentingExtension extends Extension
15 15
 {
16
-    public function alterCommentForm(Form $form)
17
-    {
18
-        $fields = $form->Fields();
16
+	public function alterCommentForm(Form $form)
17
+	{
18
+		$fields = $form->Fields();
19 19
 
20
-        if ($emailField = $fields->dataFieldByName(Email::class)) {
21
-            $emailField
22
-                ->setTitle(_t(__CLASS__ . '.EMAIL_TITLE', Email::class))
23
-                ->setDescription(_t(__CLASS__ . '.WILL_NOT_BE_PUBLISHED', 'Will not be published.'));
24
-        }
20
+		if ($emailField = $fields->dataFieldByName(Email::class)) {
21
+			$emailField
22
+				->setTitle(_t(__CLASS__ . '.EMAIL_TITLE', Email::class))
23
+				->setDescription(_t(__CLASS__ . '.WILL_NOT_BE_PUBLISHED', 'Will not be published.'));
24
+		}
25 25
 
26
-        if ($urlField = $fields->dataFieldByName('URL')) {
27
-            $urlField
28
-                ->setTitle(_t(__CLASS__ . '.WEBSITE_TITLE', 'Your website (optional)'))
29
-                ->setAttribute('placeholder', 'http://');
30
-        }
31
-    }
26
+		if ($urlField = $fields->dataFieldByName('URL')) {
27
+			$urlField
28
+				->setTitle(_t(__CLASS__ . '.WEBSITE_TITLE', 'Your website (optional)'))
29
+				->setAttribute('placeholder', 'http://');
30
+		}
31
+	}
32 32
 }
Please login to merge, or discard this patch.
src/Extensions/CwpSiteTreeFileExtension.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,53 +11,53 @@
 block discarded – undo
11 11
 class CwpSiteTreeFileExtension extends DataExtension
12 12
 {
13 13
 
14
-    public function updateCMSFields(FieldList $fields)
15
-    {
16
-        Requirements::css('cwp/cwp:css/fieldDescriptionToggle.css');
17
-        Requirements::javascript('cwp/cwp:javascript/fieldDescriptionToggle.js');
18
-
19
-        $fields->insertAfter(
20
-            'LastEdited',
21
-            ReadonlyField::create(
22
-                'BackLinkCount',
23
-                _t('SilverStripe\\CMS\\Model\\SiteTreeFileExtension.BACKLINKCOUNT', 'Used on:'),
24
-                $this->owner->BackLinkTracking()->Count() . ' '
25
-                    . _t('SilverStripe\\CMS\\Model\\SiteTreeFileExtension.PAGES', 'page(s)')
26
-            )
27
-            ->addExtraClass('cms-description-toggle')
28
-            ->setDescription($this->BackLinkHTMLList())
29
-        );
30
-    }
31
-
32
-    /**
33
-     * Generate an HTML list which provides links to where a file is used.
34
-     *
35
-     * @return string
36
-     */
37
-    public function BackLinkHTMLList()
38
-    {
39
-        $html = '<em>' . _t(
40
-            __CLASS__ . '.BACKLINK_LIST_DESCRIPTION',
41
-            'This list shows all pages where the file has been added through a WYSIWYG editor.'
42
-        ) . '</em>';
43
-        $html .= '<ul>';
44
-
45
-        foreach ($this->owner->BackLinkTracking() as $backLink) {
46
-            $listItem = '<li>';
47
-
48
-            // Add the page link
49
-            $listItem .= '<a href="' . $backLink->Link() . '" target="_blank">'
50
-                . Convert::raw2xml($backLink->MenuTitle) . '</a> &ndash; ';
51
-
52
-            // Add the CMS link
53
-            $listItem .= '<a href="' . $backLink->CMSEditLink() . '">'
54
-                . _t(__CLASS__ . '.EDIT', 'Edit') . '</a>';
55
-
56
-            $html .= $listItem . '</li>';
57
-        }
58
-
59
-        $html .= '</ul>';
60
-
61
-        return $html;
62
-    }
14
+	public function updateCMSFields(FieldList $fields)
15
+	{
16
+		Requirements::css('cwp/cwp:css/fieldDescriptionToggle.css');
17
+		Requirements::javascript('cwp/cwp:javascript/fieldDescriptionToggle.js');
18
+
19
+		$fields->insertAfter(
20
+			'LastEdited',
21
+			ReadonlyField::create(
22
+				'BackLinkCount',
23
+				_t('SilverStripe\\CMS\\Model\\SiteTreeFileExtension.BACKLINKCOUNT', 'Used on:'),
24
+				$this->owner->BackLinkTracking()->Count() . ' '
25
+					. _t('SilverStripe\\CMS\\Model\\SiteTreeFileExtension.PAGES', 'page(s)')
26
+			)
27
+			->addExtraClass('cms-description-toggle')
28
+			->setDescription($this->BackLinkHTMLList())
29
+		);
30
+	}
31
+
32
+	/**
33
+	 * Generate an HTML list which provides links to where a file is used.
34
+	 *
35
+	 * @return string
36
+	 */
37
+	public function BackLinkHTMLList()
38
+	{
39
+		$html = '<em>' . _t(
40
+			__CLASS__ . '.BACKLINK_LIST_DESCRIPTION',
41
+			'This list shows all pages where the file has been added through a WYSIWYG editor.'
42
+		) . '</em>';
43
+		$html .= '<ul>';
44
+
45
+		foreach ($this->owner->BackLinkTracking() as $backLink) {
46
+			$listItem = '<li>';
47
+
48
+			// Add the page link
49
+			$listItem .= '<a href="' . $backLink->Link() . '" target="_blank">'
50
+				. Convert::raw2xml($backLink->MenuTitle) . '</a> &ndash; ';
51
+
52
+			// Add the CMS link
53
+			$listItem .= '<a href="' . $backLink->CMSEditLink() . '">'
54
+				. _t(__CLASS__ . '.EDIT', 'Edit') . '</a>';
55
+
56
+			$html .= $listItem . '</li>';
57
+		}
58
+
59
+		$html .= '</ul>';
60
+
61
+		return $html;
62
+	}
63 63
 }
Please login to merge, or discard this patch.
src/Extensions/CwpSiteTreeExtension.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -9,39 +9,39 @@
 block discarded – undo
9 9
 
10 10
 class CwpSiteTreeExtension extends DataExtension
11 11
 {
12
-    private static $db = array(
13
-        'ShowPageUtilities' => 'Boolean(1)'
14
-    );
12
+	private static $db = array(
13
+		'ShowPageUtilities' => 'Boolean(1)'
14
+	);
15 15
 
16
-    private static $defaults = array(
17
-        'ShowPageUtilities' => true
18
-    );
16
+	private static $defaults = array(
17
+		'ShowPageUtilities' => true
18
+	);
19 19
 
20
-    /**
21
-     * Modify the settings for a SiteTree
22
-     *
23
-     * {@inheritDoc}
24
-     *
25
-     * @param FieldList $fields
26
-     */
27
-    public function updateSettingsFields(FieldList $fields)
28
-    {
29
-        $helpText = _t(
30
-            __CLASS__ . '.SHOW_PAGE_UTILITIES_HELP',
31
-            'You can disable page utilities (print, share, etc) for this page'
32
-        );
20
+	/**
21
+	 * Modify the settings for a SiteTree
22
+	 *
23
+	 * {@inheritDoc}
24
+	 *
25
+	 * @param FieldList $fields
26
+	 */
27
+	public function updateSettingsFields(FieldList $fields)
28
+	{
29
+		$helpText = _t(
30
+			__CLASS__ . '.SHOW_PAGE_UTILITIES_HELP',
31
+			'You can disable page utilities (print, share, etc) for this page'
32
+		);
33 33
 
34
-        $fields->addFieldsToTab(
35
-            'Root.Settings',
36
-            array(
37
-                LiteralField::create('PageUtilitiesHelp', $helpText),
38
-                CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities'))
39
-            )
40
-        );
41
-    }
34
+		$fields->addFieldsToTab(
35
+			'Root.Settings',
36
+			array(
37
+				LiteralField::create('PageUtilitiesHelp', $helpText),
38
+				CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities'))
39
+			)
40
+		);
41
+	}
42 42
 
43
-    public function updateFieldLabels(&$labels)
44
-    {
45
-        $labels['ShowPageUtilities'] = _t(__CLASS__ . '.SHOW_PAGE_UTILITIES', 'Show page utilities?');
46
-    }
43
+	public function updateFieldLabels(&$labels)
44
+	{
45
+		$labels['ShowPageUtilities'] = _t(__CLASS__ . '.SHOW_PAGE_UTILITIES', 'Show page utilities?');
46
+	}
47 47
 }
Please login to merge, or discard this patch.
src/Tasks/PopulateThemeSampleDataTask.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -17,133 +17,133 @@
 block discarded – undo
17 17
  */
18 18
 class PopulateThemeSampleDataTask extends BuildTask
19 19
 {
20
-    protected $title = 'Populate sample data for theme demo';
21
-
22
-    protected $description = 'Populates some sample data for showcasing the functionality of the '
23
-        . 'starter and Wātea themes';
24
-
25
-    /**
26
-     * A series of method calls to create sample data
27
-     *
28
-     * @param HTTPRequest $request
29
-     */
30
-    public function run($request)
31
-    {
32
-        $this->handleContactForm();
33
-    }
34
-
35
-    /**
36
-     * Decide whether to create a contact user defined form, and call it to be be created if so
37
-     *
38
-     * @return $this
39
-     */
40
-    protected function handleContactForm()
41
-    {
42
-        if (!$this->getContactFormExists()) {
43
-            $this->createContactForm();
44
-        }
45
-        return $this;
46
-    }
47
-
48
-    /**
49
-     * Determine whether a "contact us" userform exists yet
50
-     *
51
-     * @return bool
52
-     */
53
-    protected function getContactFormExists()
54
-    {
55
-        $exists = false;
56
-        foreach (UserDefinedForm::get()->column('ID') as $formId) {
57
-            $count = Versioned::get_all_versions(UserDefinedForm::class, $formId)
58
-                ->filter('URLSegment', 'contact')
59
-                ->count();
60
-
61
-            if ($count >= 1) {
62
-                $exists = true;
63
-                break;
64
-            }
65
-        }
66
-        return $exists;
67
-    }
68
-
69
-    /**
70
-     * Create a "contact us" userform. Please note that this form does not have any recipients by default, so
71
-     * no emails will be sent. To add recipients - edit the page in the CMS and add a recipient via the "Recipients"
72
-     * tab.
73
-     *
74
-     * @return $this
75
-     */
76
-    protected function createContactForm()
77
-    {
78
-        $form = UserDefinedForm::create(array(
79
-            'Title' => 'Contact',
80
-            'URLSegment' => 'contact',
81
-            'Content' => '<p>$UserDefinedForm</p>',
82
-            'SubmitButtonText' => 'Submit',
83
-            'ClearButtonText' => 'Clear',
84
-            'OnCompleteMessage' => "<p>Thanks, we've received your submission and will be in touch shortly.</p>",
85
-            'EnableLiveValidation' => true
86
-        ));
87
-
88
-        $form->write();
89
-
90
-        // Add form fields
91
-        $fields = array(
92
-            EditableFormStep::create([
93
-                'Title' => _t(
94
-                    'SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST',
95
-                    'First Page'
96
-                )
97
-            ]),
98
-            EditableTextField::create([
99
-                'Title' => 'Name',
100
-                'Required' => true,
101
-                'RightTitle' => 'Please enter your first and last name'
102
-            ]),
103
-            EditableEmailField::create([
104
-                'Title' => Email::class,
105
-                'Required' => true,
106
-                'Placeholder' => '[email protected]'
107
-            ]),
108
-            EditableTextField::create([
109
-                'Title' => 'Subject'
110
-            ]),
111
-            EditableTextField::create([
112
-                'Title' => 'Message',
113
-                'Required' => true,
114
-                'Rows' => 5
115
-            ])
116
-        );
117
-
118
-        foreach ($fields as $field) {
119
-            $field->write();
120
-            $form->Fields()->add($field);
121
-            $field->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
122
-        }
123
-
124
-        $form->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
125
-        $form->flushCache();
126
-
127
-        $this->output(' + Created "contact" UserDefinedForm page');
128
-
129
-        return $this;
130
-    }
131
-
132
-    /**
133
-     * Output a message either to the console or browser
134
-     *
135
-     * @param  string $message
136
-     * @return $this
137
-     */
138
-    protected function output($message)
139
-    {
140
-        if (Director::is_cli()) {
141
-            $message .= PHP_EOL;
142
-        } else {
143
-            $message = sprintf('<p>%s</p>', $message);
144
-        }
145
-        echo $message;
146
-
147
-        return $this;
148
-    }
20
+	protected $title = 'Populate sample data for theme demo';
21
+
22
+	protected $description = 'Populates some sample data for showcasing the functionality of the '
23
+		. 'starter and Wātea themes';
24
+
25
+	/**
26
+	 * A series of method calls to create sample data
27
+	 *
28
+	 * @param HTTPRequest $request
29
+	 */
30
+	public function run($request)
31
+	{
32
+		$this->handleContactForm();
33
+	}
34
+
35
+	/**
36
+	 * Decide whether to create a contact user defined form, and call it to be be created if so
37
+	 *
38
+	 * @return $this
39
+	 */
40
+	protected function handleContactForm()
41
+	{
42
+		if (!$this->getContactFormExists()) {
43
+			$this->createContactForm();
44
+		}
45
+		return $this;
46
+	}
47
+
48
+	/**
49
+	 * Determine whether a "contact us" userform exists yet
50
+	 *
51
+	 * @return bool
52
+	 */
53
+	protected function getContactFormExists()
54
+	{
55
+		$exists = false;
56
+		foreach (UserDefinedForm::get()->column('ID') as $formId) {
57
+			$count = Versioned::get_all_versions(UserDefinedForm::class, $formId)
58
+				->filter('URLSegment', 'contact')
59
+				->count();
60
+
61
+			if ($count >= 1) {
62
+				$exists = true;
63
+				break;
64
+			}
65
+		}
66
+		return $exists;
67
+	}
68
+
69
+	/**
70
+	 * Create a "contact us" userform. Please note that this form does not have any recipients by default, so
71
+	 * no emails will be sent. To add recipients - edit the page in the CMS and add a recipient via the "Recipients"
72
+	 * tab.
73
+	 *
74
+	 * @return $this
75
+	 */
76
+	protected function createContactForm()
77
+	{
78
+		$form = UserDefinedForm::create(array(
79
+			'Title' => 'Contact',
80
+			'URLSegment' => 'contact',
81
+			'Content' => '<p>$UserDefinedForm</p>',
82
+			'SubmitButtonText' => 'Submit',
83
+			'ClearButtonText' => 'Clear',
84
+			'OnCompleteMessage' => "<p>Thanks, we've received your submission and will be in touch shortly.</p>",
85
+			'EnableLiveValidation' => true
86
+		));
87
+
88
+		$form->write();
89
+
90
+		// Add form fields
91
+		$fields = array(
92
+			EditableFormStep::create([
93
+				'Title' => _t(
94
+					'SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST',
95
+					'First Page'
96
+				)
97
+			]),
98
+			EditableTextField::create([
99
+				'Title' => 'Name',
100
+				'Required' => true,
101
+				'RightTitle' => 'Please enter your first and last name'
102
+			]),
103
+			EditableEmailField::create([
104
+				'Title' => Email::class,
105
+				'Required' => true,
106
+				'Placeholder' => '[email protected]'
107
+			]),
108
+			EditableTextField::create([
109
+				'Title' => 'Subject'
110
+			]),
111
+			EditableTextField::create([
112
+				'Title' => 'Message',
113
+				'Required' => true,
114
+				'Rows' => 5
115
+			])
116
+		);
117
+
118
+		foreach ($fields as $field) {
119
+			$field->write();
120
+			$form->Fields()->add($field);
121
+			$field->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
122
+		}
123
+
124
+		$form->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
125
+		$form->flushCache();
126
+
127
+		$this->output(' + Created "contact" UserDefinedForm page');
128
+
129
+		return $this;
130
+	}
131
+
132
+	/**
133
+	 * Output a message either to the console or browser
134
+	 *
135
+	 * @param  string $message
136
+	 * @return $this
137
+	 */
138
+	protected function output($message)
139
+	{
140
+		if (Director::is_cli()) {
141
+			$message .= PHP_EOL;
142
+		} else {
143
+			$message = sprintf('<p>%s</p>', $message);
144
+		}
145
+		echo $message;
146
+
147
+		return $this;
148
+	}
149 149
 }
Please login to merge, or discard this patch.
src/PageTypes/DatedUpdatePage.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -10,70 +10,70 @@
 block discarded – undo
10 10
 
11 11
 class DatedUpdatePage extends Page
12 12
 {
13
-    /**
14
-     * Meant as an abstract base class.
15
-     *
16
-     * {@inheritDoc}
17
-     */
18
-    private static $hide_ancestor = DatedUpdatePage::class;
13
+	/**
14
+	 * Meant as an abstract base class.
15
+	 *
16
+	 * {@inheritDoc}
17
+	 */
18
+	private static $hide_ancestor = DatedUpdatePage::class;
19 19
 
20
-    private static $singular_name = 'Dated Update Page';
20
+	private static $singular_name = 'Dated Update Page';
21 21
 
22
-    private static $plural_name = 'Dated Update Pages';
22
+	private static $plural_name = 'Dated Update Pages';
23 23
 
24
-    private static $table_name = 'DatedUpdatePage';
24
+	private static $table_name = 'DatedUpdatePage';
25 25
 
26
-    private static $defaults = [
27
-        'ShowInMenus' => false,
28
-    ];
26
+	private static $defaults = [
27
+		'ShowInMenus' => false,
28
+	];
29 29
 
30
-    private static $db = [
31
-        'Abstract' => 'Text',
32
-        'Date' => 'Datetime',
33
-    ];
30
+	private static $db = [
31
+		'Abstract' => 'Text',
32
+		'Date' => 'Datetime',
33
+	];
34 34
 
35
-    /**
36
-     * Add the default for the Date being the current day.
37
-     */
38
-    public function populateDefaults()
39
-    {
40
-        parent::populateDefaults();
35
+	/**
36
+	 * Add the default for the Date being the current day.
37
+	 */
38
+	public function populateDefaults()
39
+	{
40
+		parent::populateDefaults();
41 41
 
42
-        if (!isset($this->Date) || $this->Date === null) {
43
-            $this->Date = DBDatetime::now()->Format('y-MM-dd 09:00:00');
44
-        }
45
-    }
42
+		if (!isset($this->Date) || $this->Date === null) {
43
+			$this->Date = DBDatetime::now()->Format('y-MM-dd 09:00:00');
44
+		}
45
+	}
46 46
 
47
-    public function fieldLabels($includerelations = true)
48
-    {
49
-        $labels = parent::fieldLabels($includerelations);
50
-        $labels['Date'] = _t(__CLASS__ . '.DateLabel', 'Date');
51
-        $labels['Abstract'] = _t(__CLASS__ . '.AbstractTextFieldLabel', 'Abstract');
47
+	public function fieldLabels($includerelations = true)
48
+	{
49
+		$labels = parent::fieldLabels($includerelations);
50
+		$labels['Date'] = _t(__CLASS__ . '.DateLabel', 'Date');
51
+		$labels['Abstract'] = _t(__CLASS__ . '.AbstractTextFieldLabel', 'Abstract');
52 52
 
53
-        return $labels;
54
-    }
53
+		return $labels;
54
+	}
55 55
 
56
-    public function getCMSFields()
57
-    {
58
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
59
-            $fields->addFieldToTab(
60
-                'Root.Main',
61
-                $dateTimeField = DatetimeField::create('Date', $this->fieldLabel('Date')),
62
-                'Content'
63
-            );
56
+	public function getCMSFields()
57
+	{
58
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
59
+			$fields->addFieldToTab(
60
+				'Root.Main',
61
+				$dateTimeField = DatetimeField::create('Date', $this->fieldLabel('Date')),
62
+				'Content'
63
+			);
64 64
 
65
-            $fields->addfieldToTab(
66
-                'Root.Main',
67
-                $abstractField = TextareaField::create('Abstract', $this->fieldLabel('Abstract')),
68
-                'Content'
69
-            );
70
-            $abstractField->setAttribute('maxlength', '160');
71
-            $abstractField->setRightTitle(_t(
72
-                __CLASS__ . '.AbstractDesc',
73
-                'The abstract is used as a summary on the listing pages. It is limited to 160 characters.'
74
-            ));
75
-            $abstractField->setRows(6);
76
-        });
77
-        return parent::getCMSFields();
78
-    }
65
+			$fields->addfieldToTab(
66
+				'Root.Main',
67
+				$abstractField = TextareaField::create('Abstract', $this->fieldLabel('Abstract')),
68
+				'Content'
69
+			);
70
+			$abstractField->setAttribute('maxlength', '160');
71
+			$abstractField->setRightTitle(_t(
72
+				__CLASS__ . '.AbstractDesc',
73
+				'The abstract is used as a summary on the listing pages. It is limited to 160 characters.'
74
+			));
75
+			$abstractField->setRows(6);
76
+		});
77
+		return parent::getCMSFields();
78
+	}
79 79
 }
Please login to merge, or discard this patch.