Passed
Push — master ( b62e9a...a002f8 )
by Daniel
03:04
created
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/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.
src/PageTypes/EventHolder.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,57 +7,57 @@
 block discarded – undo
7 7
 
8 8
 class EventHolder extends DatedUpdateHolder
9 9
 {
10
-    private static $description = 'Container page for Event Pages, provides event filtering and pagination';
11
-
12
-    private static $allowed_children = [
13
-        EventPage::class,
14
-    ];
15
-
16
-    private static $default_child = EventPage::class;
17
-
18
-    private static $update_name = 'Events';
19
-
20
-    private static $update_class = EventPage::class;
21
-
22
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_holder.png';
23
-
24
-    private static $singular_name = 'Event Holder';
25
-
26
-    private static $plural_name = 'Event Holders';
27
-
28
-    private static $table_name = 'EventHolder';
29
-
30
-    /**
31
-     * Find all site's news items, based on some filters.
32
-     * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
33
-     *
34
-     * @param string $className The name of the class to fetch.
35
-     * @param int $parentID The ID of the holder to extract the news items from.
36
-     * @param int $tagID The ID of the tag to filter the news items by.
37
-     * @param string $dateFrom The beginning of a date filter range.
38
-     * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
39
-     * @param int $year Numeric value of the year to show.
40
-     * @param int $monthNumber Numeric value of the month to show.
41
-     *
42
-     * @returns DataList|PaginatedList
43
-     */
44
-    public static function AllUpdates(
45
-        $className = 'Events',
46
-        $parentID = null,
47
-        $tagID = null,
48
-        $dateFrom = null,
49
-        $dateTo = null,
50
-        $year = null,
51
-        $monthNumber = null
52
-    ) {
53
-        return parent::AllUpdates(
54
-            $className,
55
-            $parentID,
56
-            $tagID,
57
-            $dateFrom,
58
-            $dateTo,
59
-            $year,
60
-            $monthNumber
61
-        )->Sort('Date', 'ASC');
62
-    }
10
+	private static $description = 'Container page for Event Pages, provides event filtering and pagination';
11
+
12
+	private static $allowed_children = [
13
+		EventPage::class,
14
+	];
15
+
16
+	private static $default_child = EventPage::class;
17
+
18
+	private static $update_name = 'Events';
19
+
20
+	private static $update_class = EventPage::class;
21
+
22
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_holder.png';
23
+
24
+	private static $singular_name = 'Event Holder';
25
+
26
+	private static $plural_name = 'Event Holders';
27
+
28
+	private static $table_name = 'EventHolder';
29
+
30
+	/**
31
+	 * Find all site's news items, based on some filters.
32
+	 * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
33
+	 *
34
+	 * @param string $className The name of the class to fetch.
35
+	 * @param int $parentID The ID of the holder to extract the news items from.
36
+	 * @param int $tagID The ID of the tag to filter the news items by.
37
+	 * @param string $dateFrom The beginning of a date filter range.
38
+	 * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
39
+	 * @param int $year Numeric value of the year to show.
40
+	 * @param int $monthNumber Numeric value of the month to show.
41
+	 *
42
+	 * @returns DataList|PaginatedList
43
+	 */
44
+	public static function AllUpdates(
45
+		$className = 'Events',
46
+		$parentID = null,
47
+		$tagID = null,
48
+		$dateFrom = null,
49
+		$dateTo = null,
50
+		$year = null,
51
+		$monthNumber = null
52
+	) {
53
+		return parent::AllUpdates(
54
+			$className,
55
+			$parentID,
56
+			$tagID,
57
+			$dateFrom,
58
+			$dateTo,
59
+			$year,
60
+			$monthNumber
61
+		)->Sort('Date', 'ASC');
62
+	}
63 63
 }
Please login to merge, or discard this patch.
src/PageTypes/NewsHolder.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
 
8 8
 class NewsHolder extends DatedUpdateHolder
9 9
 {
10
-    private static $description = 'Container page for News Pages, provides news filtering and pagination';
11
-
12
-    private static $allowed_children = [
13
-        NewsPage::class,
14
-    ];
15
-
16
-    private static $default_child = NewsPage::class;
17
-
18
-    private static $update_name = 'News';
19
-
20
-    private static $update_class = NewsPage::class;
21
-
22
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/news_listing.png';
23
-
24
-    private static $singular_name = 'News Holder';
25
-
26
-    private static $plural_name = 'News Holders';
27
-
28
-    private static $table_name = 'NewsHolder';
29
-
30
-    /**
31
-     * Find all site's news items, based on some filters.
32
-     * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
33
-     *
34
-     * @param string $className The name of the class to fetch.
35
-     * @param int $parentID The ID of the holder to extract the news items from.
36
-     * @param int $tagID The ID of the tag to filter the news items by.
37
-     * @param string $dateFrom The beginning of a date filter range.
38
-     * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
39
-     * @param int $year Numeric value of the year to show.
40
-     * @param int $monthNumber Numeric value of the month to show.
41
-     *
42
-     * @returns DataList|PaginatedList
43
-     */
44
-    public static function AllUpdates(
45
-        $className = NewsPage::class,
46
-        $parentID = null,
47
-        $tagID = null,
48
-        $dateFrom = null,
49
-        $dateTo = null,
50
-        $year = null,
51
-        $monthNumber = null
52
-    ) {
53
-        return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber)
54
-            ->Sort('Date', 'DESC');
55
-    }
10
+	private static $description = 'Container page for News Pages, provides news filtering and pagination';
11
+
12
+	private static $allowed_children = [
13
+		NewsPage::class,
14
+	];
15
+
16
+	private static $default_child = NewsPage::class;
17
+
18
+	private static $update_name = 'News';
19
+
20
+	private static $update_class = NewsPage::class;
21
+
22
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/news_listing.png';
23
+
24
+	private static $singular_name = 'News Holder';
25
+
26
+	private static $plural_name = 'News Holders';
27
+
28
+	private static $table_name = 'NewsHolder';
29
+
30
+	/**
31
+	 * Find all site's news items, based on some filters.
32
+	 * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
33
+	 *
34
+	 * @param string $className The name of the class to fetch.
35
+	 * @param int $parentID The ID of the holder to extract the news items from.
36
+	 * @param int $tagID The ID of the tag to filter the news items by.
37
+	 * @param string $dateFrom The beginning of a date filter range.
38
+	 * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
39
+	 * @param int $year Numeric value of the year to show.
40
+	 * @param int $monthNumber Numeric value of the month to show.
41
+	 *
42
+	 * @returns DataList|PaginatedList
43
+	 */
44
+	public static function AllUpdates(
45
+		$className = NewsPage::class,
46
+		$parentID = null,
47
+		$tagID = null,
48
+		$dateFrom = null,
49
+		$dateTo = null,
50
+		$year = null,
51
+		$monthNumber = null
52
+	) {
53
+		return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber)
54
+			->Sort('Date', 'DESC');
55
+	}
56 56
 }
Please login to merge, or discard this patch.
src/PageTypes/EventPage.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -12,81 +12,81 @@
 block discarded – undo
12 12
 
13 13
 class EventPage extends DatedUpdatePage
14 14
 {
15
-    private static $description = 'Describes an event occurring on a specific date.';
16
-
17
-    private static $default_parent = EventHolder::class;
18
-
19
-    private static $can_be_root = false;
20
-
21
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png';
22
-
23
-    private static $singular_name = 'Event Page';
24
-
25
-    private static $plural_name = 'Event Pages';
26
-
27
-    private static $db = [
28
-        'StartTime' => 'Time',
29
-        'EndTime' => 'Time',
30
-        'Location' => 'Text',
31
-    ];
32
-
33
-    private static $table_name = 'EventPage';
34
-
35
-    public function fieldLabels($includerelations = true)
36
-    {
37
-        $labels = parent::fieldLabels($includerelations);
38
-        $labels['StartTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.StartTimeFieldLabel', 'Start Time');
39
-        $labels['EndTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.EndTimeFieldLabel', 'End Time');
40
-        $labels['Location'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.LocationFieldLabel', 'Location');
41
-
42
-        return $labels;
43
-    }
44
-
45
-    /**
46
-     * Add the default for the Date being the current day.
47
-     */
48
-    public function populateDefaults()
49
-    {
50
-        if (!isset($this->Date) || $this->Date === null) {
51
-            $this->Date = DBDatetime::now()->Format('y-MM-dd');
52
-        }
53
-
54
-        if (!isset($this->StartTime) || $this->StartTime === null) {
55
-            $this->StartTime = '09:00:00';
56
-        }
57
-
58
-        if (!isset($this->EndTime) || $this->EndTime === null) {
59
-            $this->EndTime = '17:00:00';
60
-        }
61
-
62
-        parent::populateDefaults();
63
-    }
64
-
65
-    public function getCMSFields()
66
-    {
67
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
68
-            $fields->removeByName('Date');
69
-
70
-            $dateTimeFields = array();
71
-
72
-            $dateTimeFields[] = $dateField = DateField::create('Date', 'Date');
73
-            $dateTimeFields[] = $startTimeField = TimeField::create(
74
-                'StartTime',
75
-                '  ' . $this->fieldLabel('StartTime')
76
-            );
77
-            $dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime'));
78
-
79
-            $fields->addFieldsToTab('Root.Main', [
80
-                $dateTimeField = FieldGroup::create('Date and time', $dateTimeFields),
81
-                $locationField = TextareaField::create('Location', $this->fieldLabel('Location'))
82
-            ], 'Abstract');
83
-            $locationField->setRows(4);
84
-        });
85
-        return parent::getCMSFields();
86
-    }
87
-
88
-    public function NiceLocation()
89
-    {
90
-        return nl2br(Convert::raw2xml($this->Location), true);
91
-    }
15
+	private static $description = 'Describes an event occurring on a specific date.';
16
+
17
+	private static $default_parent = EventHolder::class;
18
+
19
+	private static $can_be_root = false;
20
+
21
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png';
22
+
23
+	private static $singular_name = 'Event Page';
24
+
25
+	private static $plural_name = 'Event Pages';
26
+
27
+	private static $db = [
28
+		'StartTime' => 'Time',
29
+		'EndTime' => 'Time',
30
+		'Location' => 'Text',
31
+	];
32
+
33
+	private static $table_name = 'EventPage';
34
+
35
+	public function fieldLabels($includerelations = true)
36
+	{
37
+		$labels = parent::fieldLabels($includerelations);
38
+		$labels['StartTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.StartTimeFieldLabel', 'Start Time');
39
+		$labels['EndTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.EndTimeFieldLabel', 'End Time');
40
+		$labels['Location'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.LocationFieldLabel', 'Location');
41
+
42
+		return $labels;
43
+	}
44
+
45
+	/**
46
+	 * Add the default for the Date being the current day.
47
+	 */
48
+	public function populateDefaults()
49
+	{
50
+		if (!isset($this->Date) || $this->Date === null) {
51
+			$this->Date = DBDatetime::now()->Format('y-MM-dd');
52
+		}
53
+
54
+		if (!isset($this->StartTime) || $this->StartTime === null) {
55
+			$this->StartTime = '09:00:00';
56
+		}
57
+
58
+		if (!isset($this->EndTime) || $this->EndTime === null) {
59
+			$this->EndTime = '17:00:00';
60
+		}
61
+
62
+		parent::populateDefaults();
63
+	}
64
+
65
+	public function getCMSFields()
66
+	{
67
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
68
+			$fields->removeByName('Date');
69
+
70
+			$dateTimeFields = array();
71
+
72
+			$dateTimeFields[] = $dateField = DateField::create('Date', 'Date');
73
+			$dateTimeFields[] = $startTimeField = TimeField::create(
74
+				'StartTime',
75
+				'  ' . $this->fieldLabel('StartTime')
76
+			);
77
+			$dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime'));
78
+
79
+			$fields->addFieldsToTab('Root.Main', [
80
+				$dateTimeField = FieldGroup::create('Date and time', $dateTimeFields),
81
+				$locationField = TextareaField::create('Location', $this->fieldLabel('Location'))
82
+			], 'Abstract');
83
+			$locationField->setRows(4);
84
+		});
85
+		return parent::getCMSFields();
86
+	}
87
+
88
+	public function NiceLocation()
89
+	{
90
+		return nl2br(Convert::raw2xml($this->Location), true);
91
+	}
92 92
 }
Please login to merge, or discard this patch.
src/PageTypes/NewsPage.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -9,55 +9,55 @@
 block discarded – undo
9 9
 
10 10
 class NewsPage extends DatedUpdatePage
11 11
 {
12
-    private static $description = 'Describes an item of news';
12
+	private static $description = 'Describes an item of news';
13 13
 
14
-    private static $default_parent = 'NewsHolderPage';
14
+	private static $default_parent = 'NewsHolderPage';
15 15
 
16
-    private static $can_be_root = false;
16
+	private static $can_be_root = false;
17 17
 
18
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/news.png';
18
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/news.png';
19 19
 
20
-    private static $singular_name = 'News Page';
20
+	private static $singular_name = 'News Page';
21 21
 
22
-    private static $plural_name = 'News Pages';
22
+	private static $plural_name = 'News Pages';
23 23
 
24
-    private static $db = [
25
-        'Author' => 'Varchar(255)',
26
-    ];
24
+	private static $db = [
25
+		'Author' => 'Varchar(255)',
26
+	];
27 27
 
28
-    private static $has_one = [
29
-        'FeaturedImage' => Image::class,
30
-    ];
28
+	private static $has_one = [
29
+		'FeaturedImage' => Image::class,
30
+	];
31 31
 
32
-    private static $table_name = 'NewsPage';
32
+	private static $table_name = 'NewsPage';
33 33
 
34
-    public function fieldLabels($includerelations = true)
35
-    {
36
-        $labels = parent::fieldLabels($includerelations);
37
-        $labels['Author'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.AuthorFieldLabel', 'Author');
38
-        $labels['FeaturedImageID'] = _t(
39
-            'CWP\\CWP\\PageTypes\\DateUpdatePage.FeaturedImageFieldLabel',
40
-            'Featured Image'
41
-        );
34
+	public function fieldLabels($includerelations = true)
35
+	{
36
+		$labels = parent::fieldLabels($includerelations);
37
+		$labels['Author'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.AuthorFieldLabel', 'Author');
38
+		$labels['FeaturedImageID'] = _t(
39
+			'CWP\\CWP\\PageTypes\\DateUpdatePage.FeaturedImageFieldLabel',
40
+			'Featured Image'
41
+		);
42 42
 
43
-        return $labels;
44
-    }
43
+		return $labels;
44
+	}
45 45
 
46
-    public function getCMSFields()
47
-    {
48
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
49
-            $fields->addFieldToTab(
50
-                'Root.Main',
51
-                TextField::create('Author', $this->fieldLabel('Author')),
52
-                'Abstract'
53
-            );
46
+	public function getCMSFields()
47
+	{
48
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
49
+			$fields->addFieldToTab(
50
+				'Root.Main',
51
+				TextField::create('Author', $this->fieldLabel('Author')),
52
+				'Abstract'
53
+			);
54 54
 
55
-            $fields->addFieldToTab(
56
-                'Root.Main',
57
-                UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')),
58
-                'Abstract'
59
-            );
60
-        });
61
-        return parent::getCMSFields();
62
-    }
55
+			$fields->addFieldToTab(
56
+				'Root.Main',
57
+				UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')),
58
+				'Abstract'
59
+			);
60
+		});
61
+		return parent::getCMSFields();
62
+	}
63 63
 }
Please login to merge, or discard this patch.
src/PageTypes/EventHolderController.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -19,53 +19,53 @@
 block discarded – undo
19 19
  */
20 20
 class EventHolderController extends DatedUpdateHolderController
21 21
 {
22
-    public function getUpdateName()
23
-    {
24
-        $params = $this->parseParams();
25
-        if ($params['upcomingOnly']) {
26
-            return _t(__CLASS__ . '.Upcoming', 'Upcoming events');
27
-        }
22
+	public function getUpdateName()
23
+	{
24
+		$params = $this->parseParams();
25
+		if ($params['upcomingOnly']) {
26
+			return _t(__CLASS__ . '.Upcoming', 'Upcoming events');
27
+		}
28 28
 
29
-        return _t(__CLASS__ . '.Events', 'Events');
30
-    }
29
+		return _t(__CLASS__ . '.Events', 'Events');
30
+	}
31 31
 
32
-    /**
33
-     * Parse URL parameters.
34
-     *
35
-     * @param boolean $produceErrorMessages Set to false to omit session messages.
36
-     */
37
-    public function parseParams($produceErrorMessages = true)
38
-    {
39
-        $params = parent::parseParams($produceErrorMessages);
32
+	/**
33
+	 * Parse URL parameters.
34
+	 *
35
+	 * @param boolean $produceErrorMessages Set to false to omit session messages.
36
+	 */
37
+	public function parseParams($produceErrorMessages = true)
38
+	{
39
+		$params = parent::parseParams($produceErrorMessages);
40 40
 
41
-        // We need to set whether or not we're supposed to be displaying only upcoming events or all events.
42
-        $params['upcomingOnly'] = !($params['from'] || $params['to'] || $params['year'] || $params['month']);
41
+		// We need to set whether or not we're supposed to be displaying only upcoming events or all events.
42
+		$params['upcomingOnly'] = !($params['from'] || $params['to'] || $params['year'] || $params['month']);
43 43
 
44
-        return $params;
45
-    }
44
+		return $params;
45
+	}
46 46
 
47
-    /**
48
-     * Get the events based on the current query.
49
-     */
50
-    public function FilteredUpdates($pageSize = 20)
51
-    {
52
-        $params = $this->parseParams();
47
+	/**
48
+	 * Get the events based on the current query.
49
+	 */
50
+	public function FilteredUpdates($pageSize = 20)
51
+	{
52
+		$params = $this->parseParams();
53 53
 
54
-        $items = $this->Updates(
55
-            $params['tag'],
56
-            $params['from'],
57
-            $params['to'],
58
-            $params['year'],
59
-            $params['month']
60
-        );
54
+		$items = $this->Updates(
55
+			$params['tag'],
56
+			$params['from'],
57
+			$params['to'],
58
+			$params['year'],
59
+			$params['month']
60
+		);
61 61
 
62
-        if ($params['upcomingOnly']) {
63
-            $items = $items->filter(['Date:LessThan:Not' => DBDatetime::now()->Format('y-MM-dd')]);
64
-        }
62
+		if ($params['upcomingOnly']) {
63
+			$items = $items->filter(['Date:LessThan:Not' => DBDatetime::now()->Format('y-MM-dd')]);
64
+		}
65 65
 
66
-        // Apply pagination
67
-        $list = PaginatedList::create($items, $this->getRequest());
68
-        $list->setPageLength($pageSize);
69
-        return $list;
70
-    }
66
+		// Apply pagination
67
+		$list = PaginatedList::create($items, $this->getRequest());
68
+		$list->setPageLength($pageSize);
69
+		return $list;
70
+	}
71 71
 }
Please login to merge, or discard this patch.
src/Model/QuickLink.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -11,117 +11,117 @@
 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
-                        sprintf('<div class="message good notice">%s</div>', _t(
106
-                            __CLASS__ . '.Note',
107
-                            'Note: If you specify an External Link, the Internal Link will be ignored.'
108
-                        ))
109
-                    )
110
-                )
111
-            )
112
-        ));
113
-        $fields->insertBefore(
114
-            'Name',
115
-            LiteralField::create(
116
-                'Note',
117
-                sprintf('<p>%s</p>', _t(
118
-                    __CLASS__ . '.Note2',
119
-                    'Use this to specify a link to a page either on this site '
120
-                        . '(Internal Link) or another site (External Link).'
121
-                ))
122
-            )
123
-        );
124
-
125
-        return $fields;
126
-    }
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
+						sprintf('<div class="message good notice">%s</div>', _t(
106
+							__CLASS__ . '.Note',
107
+							'Note: If you specify an External Link, the Internal Link will be ignored.'
108
+						))
109
+					)
110
+				)
111
+			)
112
+		));
113
+		$fields->insertBefore(
114
+			'Name',
115
+			LiteralField::create(
116
+				'Note',
117
+				sprintf('<p>%s</p>', _t(
118
+					__CLASS__ . '.Note2',
119
+					'Use this to specify a link to a page either on this site '
120
+						. '(Internal Link) or another site (External Link).'
121
+				))
122
+			)
123
+		);
124
+
125
+		return $fields;
126
+	}
127 127
 }
Please login to merge, or discard this patch.
tests/PageTypes/DatedUpdateHolderControllerTest.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,36 +9,36 @@
 block discarded – undo
9 9
 
10 10
 class DatedUpdateHolderControllerTest extends FunctionalTest
11 11
 {
12
-    protected static $fixture_file = 'EventHolderTest.yml';
12
+	protected static $fixture_file = 'EventHolderTest.yml';
13 13
 
14
-    protected static $use_draft_site = true;
14
+	protected static $use_draft_site = true;
15 15
 
16
-    protected function setUp()
17
-    {
18
-        parent::setUp();
16
+	protected function setUp()
17
+	{
18
+		parent::setUp();
19 19
 
20
-        // Note: this test requires the starter theme to be installed
21
-        Config::modify()->set(SSViewer::class, 'themes', ['starter', '$default']);
22
-        Config::modify()->set(SSViewer::class, 'theme', 'starter');
23
-    }
20
+		// Note: this test requires the starter theme to be installed
21
+		Config::modify()->set(SSViewer::class, 'themes', ['starter', '$default']);
22
+		Config::modify()->set(SSViewer::class, 'theme', 'starter');
23
+	}
24 24
 
25
-    public function testSettingDateFiltersInReverseOrderShowsMessage()
26
-    {
27
-        /** @var EventHolder $holder */
28
-        $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1');
25
+	public function testSettingDateFiltersInReverseOrderShowsMessage()
26
+	{
27
+		/** @var EventHolder $holder */
28
+		$holder = $this->objFromFixture(EventHolder::class, 'EventHolder1');
29 29
 
30
-        $result = $this->get($holder->Link() . '?from=2018-01-10&to=2018-01-01');
30
+		$result = $this->get($holder->Link() . '?from=2018-01-10&to=2018-01-01');
31 31
 
32
-        $this->assertContains('Filter has been applied with the dates reversed', $result->getBody());
33
-    }
32
+		$this->assertContains('Filter has been applied with the dates reversed', $result->getBody());
33
+	}
34 34
 
35
-    public function testSettingFromButNotToDateShowsMessage()
36
-    {
37
-        /** @var EventHolder $holder */
38
-        $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1');
35
+	public function testSettingFromButNotToDateShowsMessage()
36
+	{
37
+		/** @var EventHolder $holder */
38
+		$holder = $this->objFromFixture(EventHolder::class, 'EventHolder1');
39 39
 
40
-        $result = $this->get($holder->Link() . '?from=2018-01-10');
40
+		$result = $this->get($holder->Link() . '?from=2018-01-10');
41 41
 
42
-        $this->assertContains('Filtered by a single date', $result->getBody());
43
-    }
42
+		$this->assertContains('Filtered by a single date', $result->getBody());
43
+	}
44 44
 }
Please login to merge, or discard this patch.