Completed
Pull Request — master (#15)
by Robbie
04:45
created
src/PageTypes/NewsPage.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -9,54 +9,54 @@
 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 $pageIcon =  'images/icons/sitetree_images/news.png';
34
+	public $pageIcon =  'images/icons/sitetree_images/news.png';
35 35
 
36
-    public function fieldLabels($includerelations = true)
37
-    {
38
-        $labels = parent::fieldLabels($includerelations);
39
-        $labels['Author'] = _t('DateUpdatePage.AuthorFieldLabel', 'Author');
40
-        $labels['FeaturedImageID'] = _t('DateUpdatePage.FeaturedImageFieldLabel', 'Featured Image');
36
+	public function fieldLabels($includerelations = true)
37
+	{
38
+		$labels = parent::fieldLabels($includerelations);
39
+		$labels['Author'] = _t('DateUpdatePage.AuthorFieldLabel', 'Author');
40
+		$labels['FeaturedImageID'] = _t('DateUpdatePage.FeaturedImageFieldLabel', 'Featured Image');
41 41
 
42
-        return $labels;
43
-    }
42
+		return $labels;
43
+	}
44 44
 
45
-    public function getCMSFields()
46
-    {
47
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
48
-            $fields->addFieldToTab(
49
-                'Root.Main',
50
-                TextField::create('Author', $this->fieldLabel('Author')),
51
-                'Abstract'
52
-            );
45
+	public function getCMSFields()
46
+	{
47
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
48
+			$fields->addFieldToTab(
49
+				'Root.Main',
50
+				TextField::create('Author', $this->fieldLabel('Author')),
51
+				'Abstract'
52
+			);
53 53
 
54
-            $fields->addFieldToTab(
55
-                'Root.Main',
56
-                UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')),
57
-                'Abstract'
58
-            );
59
-        });
60
-        return parent::getCMSFields();
61
-    }
54
+			$fields->addFieldToTab(
55
+				'Root.Main',
56
+				UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')),
57
+				'Abstract'
58
+			);
59
+		});
60
+		return parent::getCMSFields();
61
+	}
62 62
 }
Please login to merge, or discard this patch.
src/PageTypes/BaseHomePage.php 1 patch
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -26,139 +26,139 @@
 block discarded – undo
26 26
  */
27 27
 class BaseHomePage extends Page
28 28
 {
29
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/home.png';
30
-
31
-    private static $hide_ancestor = BaseHomePage::class;
32
-
33
-    private static $singular_name = 'Home Page';
34
-
35
-    private static $plural_name = 'Home Pages';
36
-
37
-    private static $table_name = 'BaseHomePage';
38
-
39
-    private static $db = array(
40
-        'FeatureOneTitle' => 'Varchar(255)',
41
-        'FeatureOneCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')",
42
-        'FeatureOneContent' => 'HTMLText',
43
-        'FeatureOneButtonText' => 'Varchar(255)',
44
-        'FeatureTwoTitle' => 'Varchar(255)',
45
-        'FeatureTwoCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')",
46
-        'FeatureTwoContent' => 'HTMLText',
47
-        'FeatureTwoButtonText' => 'Varchar(255)'
48
-    );
49
-
50
-    private static $has_one = array(
51
-        'LearnMorePage' => SiteTree::class,
52
-        'FeatureOneLink' => SiteTree::class,
53
-        'FeatureTwoLink' => SiteTree::class
54
-    );
55
-
56
-    private static $has_many = array(
57
-        'Quicklinks' => 'Quicklink.Parent'
58
-    );
59
-
60
-    public $pageIcon = 'images/icons/sitetree_images/home.png';
61
-
62
-    public function Quicklinks()
63
-    {
64
-        return $this->getComponents('Quicklinks')->sort('SortOrder');
65
-    }
66
-
67
-    public function getCMSFields()
68
-    {
69
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
70
-            // Main Content tab
71
-            $fields->addFieldToTab(
72
-                'Root.Main',
73
-                TreeDropdownField::create(
74
-                    'LearnMorePageID',
75
-                    _t('BaseHomePage.LearnMoreLink', 'Page to link the "Learn More" button to:'),
76
-                    SiteTree::class
77
-                ),
78
-                'Metadata'
79
-            );
80
-
81
-            $gridField = GridField::create(
82
-                'Quicklinks',
83
-                'Quicklinks',
84
-                $this->Quicklinks(),
85
-                GridFieldConfig_RelationEditor::create()
86
-            );
87
-            $gridConfig = $gridField->getConfig();
88
-            $gridConfig->getComponentByType(GridFieldAddNewButton::class)->setButtonName(
89
-                _t('BaseHomePage.AddNewButton', 'Add new')
90
-            );
91
-
92
-            $injector = Injector::inst();
93
-
94
-            $gridConfig->removeComponentsByType(GridFieldAddExistingAutocompleter::class);
95
-            $gridConfig->removeComponentsByType(GridFieldDeleteAction::class);
96
-            $gridConfig->addComponent($injector->create(GridFieldDeleteAction::class));
97
-            $gridConfig->addComponent($injector->create(GridFieldSortableRows::class, 'SortOrder'));
98
-            $gridField->setModelClass(Quicklink::class);
99
-
100
-            $fields->addFieldToTab('Root.Quicklinks', $gridField);
101
-
102
-            $fields->removeByName('Import');
103
-
104
-            $fields->addFieldToTab(
105
-                'Root.Features',
106
-                ToggleCompositeField::create(
107
-                    'FeatureOne',
108
-                    _t('SiteTree.FeatureOne', 'Feature One'),
109
-                    array(
110
-                        TextField::create('FeatureOneTitle', _t('BaseHomePage.Title', 'Title')),
111
-                        $dropdownField = DropdownField::create(
112
-                            'FeatureOneCategory',
113
-                            _t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'),
114
-                            singleton(BaseHomePage::class)->dbObject('FeatureOneCategory')->enumValues()
115
-                        ),
116
-                        HTMLEditorField::create(
117
-                            'FeatureOneContent',
118
-                            _t('BaseHomePage.FeatureContentFieldLabel', 'Content')
119
-                        ),
120
-                        TextField::create(
121
-                            'FeatureOneButtonText',
122
-                            _t('BaseHomePage.FeatureButtonText', 'Button text')
123
-                        ),
124
-                        TreeDropdownField::create(
125
-                            'FeatureOneLinkID',
126
-                            _t('BaseHomePage.FeatureLink', 'Page to link to'),
127
-                            SiteTree::class
128
-                        )->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in'))
129
-                    )
130
-                )->setHeadingLevel(3)
131
-            );
132
-            $dropdownField->setEmptyString('none');
133
-
134
-            $fields->addFieldToTab('Root.Features', ToggleCompositeField::create(
135
-                'FeatureTwo',
136
-                _t('SiteTree.FeatureTwo', 'Feature Two'),
137
-                array(
138
-                    TextField::create('FeatureTwoTitle', _t('BaseHomePage.Title', 'Title')),
139
-                    $dropdownField = DropdownField::create(
140
-                        'FeatureTwoCategory',
141
-                        _t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'),
142
-                        singleton(BaseHomePage::class)->dbObject('FeatureTwoCategory')->enumValues()
143
-                    ),
144
-                    HTMLEditorField::create(
145
-                        'FeatureTwoContent',
146
-                        _t('BaseHomePage.FeatureContentFieldLabel', 'Content')
147
-                    ),
148
-                    TextField::create(
149
-                        'FeatureTwoButtonText',
150
-                        _t('BaseHomePage.FeatureButtonText', 'Button text')
151
-                    ),
152
-                    TreeDropdownField::create(
153
-                        'FeatureTwoLinkID',
154
-                        _t('BaseHomePage.FeatureLink', 'Page to link to'),
155
-                        SiteTree::class
156
-                    )->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in'))
157
-                )
158
-            )->setHeadingLevel(3));
159
-            $dropdownField->setEmptyString('none');
160
-        });
161
-
162
-        return parent::getCMSFields();
163
-    }
29
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/home.png';
30
+
31
+	private static $hide_ancestor = BaseHomePage::class;
32
+
33
+	private static $singular_name = 'Home Page';
34
+
35
+	private static $plural_name = 'Home Pages';
36
+
37
+	private static $table_name = 'BaseHomePage';
38
+
39
+	private static $db = array(
40
+		'FeatureOneTitle' => 'Varchar(255)',
41
+		'FeatureOneCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')",
42
+		'FeatureOneContent' => 'HTMLText',
43
+		'FeatureOneButtonText' => 'Varchar(255)',
44
+		'FeatureTwoTitle' => 'Varchar(255)',
45
+		'FeatureTwoCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')",
46
+		'FeatureTwoContent' => 'HTMLText',
47
+		'FeatureTwoButtonText' => 'Varchar(255)'
48
+	);
49
+
50
+	private static $has_one = array(
51
+		'LearnMorePage' => SiteTree::class,
52
+		'FeatureOneLink' => SiteTree::class,
53
+		'FeatureTwoLink' => SiteTree::class
54
+	);
55
+
56
+	private static $has_many = array(
57
+		'Quicklinks' => 'Quicklink.Parent'
58
+	);
59
+
60
+	public $pageIcon = 'images/icons/sitetree_images/home.png';
61
+
62
+	public function Quicklinks()
63
+	{
64
+		return $this->getComponents('Quicklinks')->sort('SortOrder');
65
+	}
66
+
67
+	public function getCMSFields()
68
+	{
69
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
70
+			// Main Content tab
71
+			$fields->addFieldToTab(
72
+				'Root.Main',
73
+				TreeDropdownField::create(
74
+					'LearnMorePageID',
75
+					_t('BaseHomePage.LearnMoreLink', 'Page to link the "Learn More" button to:'),
76
+					SiteTree::class
77
+				),
78
+				'Metadata'
79
+			);
80
+
81
+			$gridField = GridField::create(
82
+				'Quicklinks',
83
+				'Quicklinks',
84
+				$this->Quicklinks(),
85
+				GridFieldConfig_RelationEditor::create()
86
+			);
87
+			$gridConfig = $gridField->getConfig();
88
+			$gridConfig->getComponentByType(GridFieldAddNewButton::class)->setButtonName(
89
+				_t('BaseHomePage.AddNewButton', 'Add new')
90
+			);
91
+
92
+			$injector = Injector::inst();
93
+
94
+			$gridConfig->removeComponentsByType(GridFieldAddExistingAutocompleter::class);
95
+			$gridConfig->removeComponentsByType(GridFieldDeleteAction::class);
96
+			$gridConfig->addComponent($injector->create(GridFieldDeleteAction::class));
97
+			$gridConfig->addComponent($injector->create(GridFieldSortableRows::class, 'SortOrder'));
98
+			$gridField->setModelClass(Quicklink::class);
99
+
100
+			$fields->addFieldToTab('Root.Quicklinks', $gridField);
101
+
102
+			$fields->removeByName('Import');
103
+
104
+			$fields->addFieldToTab(
105
+				'Root.Features',
106
+				ToggleCompositeField::create(
107
+					'FeatureOne',
108
+					_t('SiteTree.FeatureOne', 'Feature One'),
109
+					array(
110
+						TextField::create('FeatureOneTitle', _t('BaseHomePage.Title', 'Title')),
111
+						$dropdownField = DropdownField::create(
112
+							'FeatureOneCategory',
113
+							_t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'),
114
+							singleton(BaseHomePage::class)->dbObject('FeatureOneCategory')->enumValues()
115
+						),
116
+						HTMLEditorField::create(
117
+							'FeatureOneContent',
118
+							_t('BaseHomePage.FeatureContentFieldLabel', 'Content')
119
+						),
120
+						TextField::create(
121
+							'FeatureOneButtonText',
122
+							_t('BaseHomePage.FeatureButtonText', 'Button text')
123
+						),
124
+						TreeDropdownField::create(
125
+							'FeatureOneLinkID',
126
+							_t('BaseHomePage.FeatureLink', 'Page to link to'),
127
+							SiteTree::class
128
+						)->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in'))
129
+					)
130
+				)->setHeadingLevel(3)
131
+			);
132
+			$dropdownField->setEmptyString('none');
133
+
134
+			$fields->addFieldToTab('Root.Features', ToggleCompositeField::create(
135
+				'FeatureTwo',
136
+				_t('SiteTree.FeatureTwo', 'Feature Two'),
137
+				array(
138
+					TextField::create('FeatureTwoTitle', _t('BaseHomePage.Title', 'Title')),
139
+					$dropdownField = DropdownField::create(
140
+						'FeatureTwoCategory',
141
+						_t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'),
142
+						singleton(BaseHomePage::class)->dbObject('FeatureTwoCategory')->enumValues()
143
+					),
144
+					HTMLEditorField::create(
145
+						'FeatureTwoContent',
146
+						_t('BaseHomePage.FeatureContentFieldLabel', 'Content')
147
+					),
148
+					TextField::create(
149
+						'FeatureTwoButtonText',
150
+						_t('BaseHomePage.FeatureButtonText', 'Button text')
151
+					),
152
+					TreeDropdownField::create(
153
+						'FeatureTwoLinkID',
154
+						_t('BaseHomePage.FeatureLink', 'Page to link to'),
155
+						SiteTree::class
156
+					)->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in'))
157
+				)
158
+			)->setHeadingLevel(3));
159
+			$dropdownField->setEmptyString('none');
160
+		});
161
+
162
+		return parent::getCMSFields();
163
+	}
164 164
 }
Please login to merge, or discard this patch.
src/PageTypes/NewsHolder.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -7,52 +7,52 @@
 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
-    public $pageIcon =  'images/icons/sitetree_images/news_listing.png';
25
-
26
-    private static $singular_name = 'News Holder';
27
-
28
-    private static $plural_name = 'News Holders';
29
-
30
-    private static $table_name = 'NewsHolder';
31
-
32
-    /**
33
-     * Find all site's news items, based on some filters.
34
-     * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
35
-     *
36
-     * @param string $className The name of the class to fetch.
37
-     * @param int $parentID The ID of the holder to extract the news items from.
38
-     * @param int $tagID The ID of the tag to filter the news items by.
39
-     * @param string $dateFrom The beginning of a date filter range.
40
-     * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
41
-     * @param int $year Numeric value of the year to show.
42
-     * @param int $monthNumber Numeric value of the month to show.
43
-     *
44
-     * @returns DataList|PaginatedList
45
-     */
46
-    public static function AllUpdates(
47
-        $className = NewsPage::class,
48
-        $parentID = null,
49
-        $tagID = null,
50
-        $dateFrom = null,
51
-        $dateTo = null,
52
-        $year = null,
53
-        $monthNumber = null
54
-    ) {
55
-        return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber)
56
-            ->Sort('Date', 'DESC');
57
-    }
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
+	public $pageIcon =  'images/icons/sitetree_images/news_listing.png';
25
+
26
+	private static $singular_name = 'News Holder';
27
+
28
+	private static $plural_name = 'News Holders';
29
+
30
+	private static $table_name = 'NewsHolder';
31
+
32
+	/**
33
+	 * Find all site's news items, based on some filters.
34
+	 * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
35
+	 *
36
+	 * @param string $className The name of the class to fetch.
37
+	 * @param int $parentID The ID of the holder to extract the news items from.
38
+	 * @param int $tagID The ID of the tag to filter the news items by.
39
+	 * @param string $dateFrom The beginning of a date filter range.
40
+	 * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
41
+	 * @param int $year Numeric value of the year to show.
42
+	 * @param int $monthNumber Numeric value of the month to show.
43
+	 *
44
+	 * @returns DataList|PaginatedList
45
+	 */
46
+	public static function AllUpdates(
47
+		$className = NewsPage::class,
48
+		$parentID = null,
49
+		$tagID = null,
50
+		$dateFrom = null,
51
+		$dateTo = null,
52
+		$year = null,
53
+		$monthNumber = null
54
+	) {
55
+		return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber)
56
+			->Sort('Date', 'DESC');
57
+	}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     private static $icon = 'cwp/cwp:images/icons/sitetree_images/news_listing.png';
23 23
 
24
-    public $pageIcon =  'images/icons/sitetree_images/news_listing.png';
24
+    public $pageIcon = 'images/icons/sitetree_images/news_listing.png';
25 25
 
26 26
     private static $singular_name = 'News Holder';
27 27
 
Please login to merge, or discard this patch.
src/PageTypes/EventHolder.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -7,59 +7,59 @@
 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';
10
+	private static $description = 'Container page for Event Pages, provides event filtering and pagination';
11 11
 
12
-    private static $allowed_children = [
13
-        EventPage::class,
14
-    ];
12
+	private static $allowed_children = [
13
+		EventPage::class,
14
+	];
15 15
 
16
-    private static $default_child = EventPage::class;
16
+	private static $default_child = EventPage::class;
17 17
 
18
-    private static $update_name = 'Events';
18
+	private static $update_name = 'Events';
19 19
 
20
-    private static $update_class = EventPage::class;
20
+	private static $update_class = EventPage::class;
21 21
 
22
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_holder.png';
22
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_holder.png';
23 23
 
24
-    public $pageIcon = 'images/icons/sitetree_images/event_holder.png';
24
+	public $pageIcon = 'images/icons/sitetree_images/event_holder.png';
25 25
 
26
-    private static $singular_name = 'Event Holder';
26
+	private static $singular_name = 'Event Holder';
27 27
 
28
-    private static $plural_name = 'Event Holders';
28
+	private static $plural_name = 'Event Holders';
29 29
 
30
-    private static $table_name = 'EventHolder';
30
+	private static $table_name = 'EventHolder';
31 31
 
32
-    /**
33
-     * Find all site's news items, based on some filters.
34
-     * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
35
-     *
36
-     * @param string $className The name of the class to fetch.
37
-     * @param int $parentID The ID of the holder to extract the news items from.
38
-     * @param int $tagID The ID of the tag to filter the news items by.
39
-     * @param string $dateFrom The beginning of a date filter range.
40
-     * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
41
-     * @param int $year Numeric value of the year to show.
42
-     * @param int $monthNumber Numeric value of the month to show.
43
-     *
44
-     * @returns DataList|PaginatedList
45
-     */
46
-    public static function AllUpdates(
47
-        $className = 'Events',
48
-        $parentID = null,
49
-        $tagID = null,
50
-        $dateFrom = null,
51
-        $dateTo = null,
52
-        $year = null,
53
-        $monthNumber = null
54
-    ) {
55
-        return parent::AllUpdates(
56
-            $className,
57
-            $parentID,
58
-            $tagID,
59
-            $dateFrom,
60
-            $dateTo,
61
-            $year,
62
-            $monthNumber
63
-        )->Sort('Date', 'ASC');
64
-    }
32
+	/**
33
+	 * Find all site's news items, based on some filters.
34
+	 * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together.
35
+	 *
36
+	 * @param string $className The name of the class to fetch.
37
+	 * @param int $parentID The ID of the holder to extract the news items from.
38
+	 * @param int $tagID The ID of the tag to filter the news items by.
39
+	 * @param string $dateFrom The beginning of a date filter range.
40
+	 * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for.
41
+	 * @param int $year Numeric value of the year to show.
42
+	 * @param int $monthNumber Numeric value of the month to show.
43
+	 *
44
+	 * @returns DataList|PaginatedList
45
+	 */
46
+	public static function AllUpdates(
47
+		$className = 'Events',
48
+		$parentID = null,
49
+		$tagID = null,
50
+		$dateFrom = null,
51
+		$dateTo = null,
52
+		$year = null,
53
+		$monthNumber = null
54
+	) {
55
+		return parent::AllUpdates(
56
+			$className,
57
+			$parentID,
58
+			$tagID,
59
+			$dateFrom,
60
+			$dateTo,
61
+			$year,
62
+			$monthNumber
63
+		)->Sort('Date', 'ASC');
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/PageTypes/BasePage.php 1 patch
Indentation   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -29,296 +29,296 @@
 block discarded – undo
29 29
 
30 30
 class BasePage extends SiteTree
31 31
 {
32
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/page.png';
32
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/page.png';
33 33
 
34
-    /**
35
-     * Hide this page type from the CMS. hide_ancestor is slightly misnamed, should really be just "hide"
36
-     *
37
-     * {@inheritDoc}
38
-     */
39
-    private static $hide_ancestor = BasePage::class;
34
+	/**
35
+	 * Hide this page type from the CMS. hide_ancestor is slightly misnamed, should really be just "hide"
36
+	 *
37
+	 * {@inheritDoc}
38
+	 */
39
+	private static $hide_ancestor = BasePage::class;
40 40
 
41
-    private static $pdf_export = false;
41
+	private static $pdf_export = false;
42 42
 
43
-    /*
43
+	/*
44 44
     *Domain to generate PDF's from, DOES not include protocol
45 45
     *i.e. google.com not http://google.com
46 46
     */
47
-    private static $pdf_base_url = "";
48
-
49
-    /**
50
-     * Allow custom overriding of the path to the WKHTMLTOPDF binary, in cases
51
-     * where multiple versions of the binary are available to choose from. This
52
-     * should be the full path to the binary (e.g. /usr/local/bin/wkhtmltopdf)
53
-     * @see BasePage_Controller::generatePDF();
54
-     */
55
-    private static $wkhtmltopdf_binary = null;
56
-
57
-    private static $generated_pdf_path = 'assets/_generated_pdfs';
58
-
59
-    private static $api_access = [
60
-        'view' => [
61
-            'Locale', 'URLSegment', 'Title', 'MenuTitle', 'Content', 'MetaDescription',
62
-            'ExtraMenu', 'Sort', 'Version', 'ParentID', 'ID'
63
-        ],
64
-        'edit' => [
65
-            'Locale', 'URLSegment', 'Title', 'MenuTitle', 'Content', 'MetaDescription',
66
-            'ExtraMenu', 'Sort', 'Version', 'ParentID', 'ID'
67
-        ],
68
-    ];
69
-
70
-    private static $table_name = 'BasePage';
71
-
72
-    public static $related_pages_title = 'Related pages';
73
-
74
-    private static $many_many = [
75
-        'Terms' => TaxonomyTerm::class,
76
-        'RelatedPages' => BasePage::class,
77
-    ];
78
-
79
-    private static $many_many_extraFields = [
80
-        'RelatedPages' => [
81
-            'SortOrder' => 'Int',
82
-        ],
83
-    ];
84
-
85
-    private static $plural_name = 'Base Pages';
86
-
87
-    public $pageIcon = 'images/icons/sitetree_images/page.png';
88
-
89
-    /**
90
-     * Get the footer holder.
91
-     */
92
-    public function getFooter()
93
-    {
94
-        return FooterHolder::get_one(FooterHolder::class);
95
-    }
96
-
97
-    /**
98
-     * Return the full filename of the pdf file, including path & extension
99
-     */
100
-    public function getPdfFilename()
101
-    {
102
-        $baseName = sprintf('%s-%s', $this->URLSegment, $this->ID);
103
-
104
-        $folderPath = Config::inst()->get(BasePage::class, 'generated_pdf_path');
105
-        if ($folderPath[0] != '/') {
106
-            $folderPath = BASE_PATH . '/' . $folderPath;
107
-        }
108
-
109
-        return sprintf('%s/%s.pdf', $folderPath, $baseName);
110
-    }
111
-
112
-    /**
113
-     * Build pdf link for template.
114
-     */
115
-    public function PdfLink()
116
-    {
117
-        if (!Config::inst()->get(BasePage::class, 'pdf_export')) {
118
-            return false;
119
-        }
120
-
121
-        $path = $this->getPdfFilename();
122
-
123
-        if ((Versioned::get_stage() === Versioned::LIVE) && file_exists($path)) {
124
-            return Director::baseURL() . preg_replace('#^/#', '', Director::makeRelative($path));
125
-        }
126
-        return $this->Link('downloadpdf');
127
-    }
128
-
129
-    public function RelatedPages()
130
-    {
131
-        return $this->getManyManyComponents('RelatedPages')->sort('SortOrder');
132
-    }
133
-
134
-    public function RelatedPagesTitle()
135
-    {
136
-        return $this->stat('related_pages_title');
137
-    }
138
-
139
-    /**
140
-     * Remove linked pdf when publishing the page,
141
-     * as it would be out of date.
142
-     */
143
-    public function onAfterPublish()
144
-    {
145
-        $filepath = $this->getPdfFilename();
146
-        if (file_exists($filepath)) {
147
-            unlink($filepath);
148
-        }
149
-    }
150
-
151
-    /**
152
-     * Remove linked pdf when unpublishing the page,
153
-     * so it's no longer valid.
154
-     *
155
-     * @return boolean
156
-     */
157
-    public function doUnpublish()
158
-    {
159
-        if (!parent::doUnpublish()) {
160
-            return false;
161
-        }
162
-
163
-        $filepath = $this->getPdfFilename();
164
-        if (file_exists($filepath)) {
165
-            unlink($filepath);
166
-        }
167
-
168
-        return true;
169
-    }
170
-
171
-    /**
172
-     * @deprecated 2.0.0 remove with other deprecations
173
-     * @todo Remove once CWP moves to 3.3 core (which includes this in SiteTree)
174
-     * @return self
175
-     */
176
-    public function doRestoreToStage()
177
-    {
178
-        $this->invokeWithExtensions('onBeforeRestoreToStage', $this);
179
-        $result = parent::doRestoreToStage();
180
-        $this->invokeWithExtensions('onAfterRestoreToStage', $this);
181
-
182
-        return $result;
183
-    }
184
-
185
-    public function getCMSFields()
186
-    {
187
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
188
-            // Related Pages
189
-            $components = GridFieldConfig_RelationEditor::create();
190
-            $components->removeComponentsByType(GridFieldAddNewButton::class);
191
-            $components->removeComponentsByType(GridFieldEditButton::class);
192
-            $components->removeComponentsByType(GridFieldFilterHeader::class);
193
-            $components->addComponent(new GridFieldSortableRows('SortOrder'));
194
-
195
-            $dataColumns = $components->getComponentByType(GridFieldDataColumns::class);
196
-            $dataColumns->setDisplayFields([
197
-                'Title' => _t('BasePage.ColumnTitle', 'Title'),
198
-                'ClassName' => _t('BasePage.ColumnPageType', 'Page Type')
199
-            ]);
200
-
201
-            $fields->findOrMakeTab(
202
-                'Root.RelatedPages',
203
-                _t('BasePage.RelatedPages', 'Related pages')
204
-            );
205
-            $fields->addFieldToTab(
206
-                'Root.RelatedPages',
207
-                GridField::create(
208
-                    'RelatedPages',
209
-                    _t('BasePage.RelatedPages', 'Related pages'),
210
-                    $this->RelatedPages(),
211
-                    $components
212
-                )
213
-            );
214
-
215
-            // Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc)
216
-            $hasMany = $this->hasMany();
217
-            $manyMany = $this->manyMany();
218
-            if (!isset($hasMany['Tags']) && !isset($manyMany['Tags'])) {
219
-                $components = GridFieldConfig_RelationEditor::create();
220
-                $components->removeComponentsByType(GridFieldAddNewButton::class);
221
-                $components->removeComponentsByType(GridFieldEditButton::class);
222
-
223
-                $autoCompleter = $components->getComponentByType(GridFieldAddExistingAutocompleter::class);
224
-                $autoCompleter->setResultsFormat('$Name ($TaxonomyName)');
225
-
226
-                $dataColumns = $components->getComponentByType(GridFieldDataColumns::class);
227
-                $dataColumns->setDisplayFields([
228
-                    'Name' => _t('BasePage.Term', 'Term'),
229
-                    'TaxonomyName' => _t('BasePage.Taxonomy', 'Taxonomy')
230
-                ]);
231
-
232
-                $fields->findOrMakeTab('Root.Tags', _t('BasePage.TagsTabTitle', 'Tags'));
233
-                $fields->addFieldToTab(
234
-                    'Root.Tags',
235
-                    TreeMultiselectField::create(
236
-                        'Terms',
237
-                        _t('BasePage.Terms', 'Terms'),
238
-                        TaxonomyTerm::class
239
-                    )->setDescription(_t('BasePage.TermsDescription', 'Click to search for additional terms'))
240
-                );
241
-            }
242
-        });
243
-        return parent::getCMSFields();
244
-    }
245
-
246
-    /**
247
-     * Provides data for translation navigation.
248
-     * Collects all site translations, marks the current one, and redirects
249
-     * to the translated home page if a. there is a translated homepage and b. the
250
-     * translation of the specific page is not available.
251
-     * @todo re-implement with Fluent
252
-     */
253
-    public function getAvailableTranslations()
254
-    {
255
-        if (!class_exists('Translatable')) {
256
-            return false;
257
-        }
258
-
259
-        $translations = new ArrayList();
260
-        $globalTranslations = Translatable::get_existing_content_languages();
261
-
262
-        foreach ($globalTranslations as $loc => $langName) {
263
-            // Find out the language name in native language.
264
-            $nativeLangName = i18n::get_language_name($loc, true);
265
-            if (!$nativeLangName) {
266
-                $nativeLangName = i18n::get_language_name(i18n::get_lang_from_locale($loc), true);
267
-            }
268
-            if (!$nativeLangName) {
269
-                // Fall back to the locale name.
270
-                $nativeLangName = $langName;
271
-            }
272
-
273
-            // Eliminate the part in brackets (e.g. [mandarin])
274
-            $nativeLangName = preg_replace('/ *[\(\[].*$/', '', $nativeLangName);
275
-
276
-            // Find out the link to the translated page.
277
-            $link = null;
278
-            $page = $this->getTranslation($loc);
279
-            if ($page) {
280
-                $link = $page->Link();
281
-            }
282
-            if (!$link) {
283
-                // Fall back to the home page
284
-                $link = Translatable::get_homepage_link_by_locale($loc);
285
-            }
286
-            if (!$link) {
287
-                continue;
288
-            }
289
-
290
-            // Assemble the table for the switcher.
291
-            $translations->push(new ArrayData(array(
292
-                'Locale' => i18n::convert_rfc1766($loc),
293
-                'LangName' => $nativeLangName,
294
-                'Link' => $link,
295
-                'Current' => (Translatable::get_current_locale()==$loc)
296
-            )));
297
-        }
298
-
299
-        if ($translations->count()>1) {
300
-            return $translations;
301
-        } else {
302
-            return null;
303
-        }
304
-    }
305
-
306
-    /**
307
-     * Returns the native language name for the selected locale/language, empty string if Translatable is not available
308
-     *
309
-     * @return string
310
-     * @todo re-implement with Fluent
311
-     */
312
-    public function getSelectedLanguage()
313
-    {
314
-        if (!class_exists('Translatable')) {
315
-            return '';
316
-        }
317
-
318
-        $language = explode('_', Translatable::get_current_locale());
319
-        $languageCode = array_shift($language);
320
-        $nativeName = i18n::get_language_name($languageCode, true);
321
-
322
-        return $nativeName;
323
-    }
47
+	private static $pdf_base_url = "";
48
+
49
+	/**
50
+	 * Allow custom overriding of the path to the WKHTMLTOPDF binary, in cases
51
+	 * where multiple versions of the binary are available to choose from. This
52
+	 * should be the full path to the binary (e.g. /usr/local/bin/wkhtmltopdf)
53
+	 * @see BasePage_Controller::generatePDF();
54
+	 */
55
+	private static $wkhtmltopdf_binary = null;
56
+
57
+	private static $generated_pdf_path = 'assets/_generated_pdfs';
58
+
59
+	private static $api_access = [
60
+		'view' => [
61
+			'Locale', 'URLSegment', 'Title', 'MenuTitle', 'Content', 'MetaDescription',
62
+			'ExtraMenu', 'Sort', 'Version', 'ParentID', 'ID'
63
+		],
64
+		'edit' => [
65
+			'Locale', 'URLSegment', 'Title', 'MenuTitle', 'Content', 'MetaDescription',
66
+			'ExtraMenu', 'Sort', 'Version', 'ParentID', 'ID'
67
+		],
68
+	];
69
+
70
+	private static $table_name = 'BasePage';
71
+
72
+	public static $related_pages_title = 'Related pages';
73
+
74
+	private static $many_many = [
75
+		'Terms' => TaxonomyTerm::class,
76
+		'RelatedPages' => BasePage::class,
77
+	];
78
+
79
+	private static $many_many_extraFields = [
80
+		'RelatedPages' => [
81
+			'SortOrder' => 'Int',
82
+		],
83
+	];
84
+
85
+	private static $plural_name = 'Base Pages';
86
+
87
+	public $pageIcon = 'images/icons/sitetree_images/page.png';
88
+
89
+	/**
90
+	 * Get the footer holder.
91
+	 */
92
+	public function getFooter()
93
+	{
94
+		return FooterHolder::get_one(FooterHolder::class);
95
+	}
96
+
97
+	/**
98
+	 * Return the full filename of the pdf file, including path & extension
99
+	 */
100
+	public function getPdfFilename()
101
+	{
102
+		$baseName = sprintf('%s-%s', $this->URLSegment, $this->ID);
103
+
104
+		$folderPath = Config::inst()->get(BasePage::class, 'generated_pdf_path');
105
+		if ($folderPath[0] != '/') {
106
+			$folderPath = BASE_PATH . '/' . $folderPath;
107
+		}
108
+
109
+		return sprintf('%s/%s.pdf', $folderPath, $baseName);
110
+	}
111
+
112
+	/**
113
+	 * Build pdf link for template.
114
+	 */
115
+	public function PdfLink()
116
+	{
117
+		if (!Config::inst()->get(BasePage::class, 'pdf_export')) {
118
+			return false;
119
+		}
120
+
121
+		$path = $this->getPdfFilename();
122
+
123
+		if ((Versioned::get_stage() === Versioned::LIVE) && file_exists($path)) {
124
+			return Director::baseURL() . preg_replace('#^/#', '', Director::makeRelative($path));
125
+		}
126
+		return $this->Link('downloadpdf');
127
+	}
128
+
129
+	public function RelatedPages()
130
+	{
131
+		return $this->getManyManyComponents('RelatedPages')->sort('SortOrder');
132
+	}
133
+
134
+	public function RelatedPagesTitle()
135
+	{
136
+		return $this->stat('related_pages_title');
137
+	}
138
+
139
+	/**
140
+	 * Remove linked pdf when publishing the page,
141
+	 * as it would be out of date.
142
+	 */
143
+	public function onAfterPublish()
144
+	{
145
+		$filepath = $this->getPdfFilename();
146
+		if (file_exists($filepath)) {
147
+			unlink($filepath);
148
+		}
149
+	}
150
+
151
+	/**
152
+	 * Remove linked pdf when unpublishing the page,
153
+	 * so it's no longer valid.
154
+	 *
155
+	 * @return boolean
156
+	 */
157
+	public function doUnpublish()
158
+	{
159
+		if (!parent::doUnpublish()) {
160
+			return false;
161
+		}
162
+
163
+		$filepath = $this->getPdfFilename();
164
+		if (file_exists($filepath)) {
165
+			unlink($filepath);
166
+		}
167
+
168
+		return true;
169
+	}
170
+
171
+	/**
172
+	 * @deprecated 2.0.0 remove with other deprecations
173
+	 * @todo Remove once CWP moves to 3.3 core (which includes this in SiteTree)
174
+	 * @return self
175
+	 */
176
+	public function doRestoreToStage()
177
+	{
178
+		$this->invokeWithExtensions('onBeforeRestoreToStage', $this);
179
+		$result = parent::doRestoreToStage();
180
+		$this->invokeWithExtensions('onAfterRestoreToStage', $this);
181
+
182
+		return $result;
183
+	}
184
+
185
+	public function getCMSFields()
186
+	{
187
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
188
+			// Related Pages
189
+			$components = GridFieldConfig_RelationEditor::create();
190
+			$components->removeComponentsByType(GridFieldAddNewButton::class);
191
+			$components->removeComponentsByType(GridFieldEditButton::class);
192
+			$components->removeComponentsByType(GridFieldFilterHeader::class);
193
+			$components->addComponent(new GridFieldSortableRows('SortOrder'));
194
+
195
+			$dataColumns = $components->getComponentByType(GridFieldDataColumns::class);
196
+			$dataColumns->setDisplayFields([
197
+				'Title' => _t('BasePage.ColumnTitle', 'Title'),
198
+				'ClassName' => _t('BasePage.ColumnPageType', 'Page Type')
199
+			]);
200
+
201
+			$fields->findOrMakeTab(
202
+				'Root.RelatedPages',
203
+				_t('BasePage.RelatedPages', 'Related pages')
204
+			);
205
+			$fields->addFieldToTab(
206
+				'Root.RelatedPages',
207
+				GridField::create(
208
+					'RelatedPages',
209
+					_t('BasePage.RelatedPages', 'Related pages'),
210
+					$this->RelatedPages(),
211
+					$components
212
+				)
213
+			);
214
+
215
+			// Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc)
216
+			$hasMany = $this->hasMany();
217
+			$manyMany = $this->manyMany();
218
+			if (!isset($hasMany['Tags']) && !isset($manyMany['Tags'])) {
219
+				$components = GridFieldConfig_RelationEditor::create();
220
+				$components->removeComponentsByType(GridFieldAddNewButton::class);
221
+				$components->removeComponentsByType(GridFieldEditButton::class);
222
+
223
+				$autoCompleter = $components->getComponentByType(GridFieldAddExistingAutocompleter::class);
224
+				$autoCompleter->setResultsFormat('$Name ($TaxonomyName)');
225
+
226
+				$dataColumns = $components->getComponentByType(GridFieldDataColumns::class);
227
+				$dataColumns->setDisplayFields([
228
+					'Name' => _t('BasePage.Term', 'Term'),
229
+					'TaxonomyName' => _t('BasePage.Taxonomy', 'Taxonomy')
230
+				]);
231
+
232
+				$fields->findOrMakeTab('Root.Tags', _t('BasePage.TagsTabTitle', 'Tags'));
233
+				$fields->addFieldToTab(
234
+					'Root.Tags',
235
+					TreeMultiselectField::create(
236
+						'Terms',
237
+						_t('BasePage.Terms', 'Terms'),
238
+						TaxonomyTerm::class
239
+					)->setDescription(_t('BasePage.TermsDescription', 'Click to search for additional terms'))
240
+				);
241
+			}
242
+		});
243
+		return parent::getCMSFields();
244
+	}
245
+
246
+	/**
247
+	 * Provides data for translation navigation.
248
+	 * Collects all site translations, marks the current one, and redirects
249
+	 * to the translated home page if a. there is a translated homepage and b. the
250
+	 * translation of the specific page is not available.
251
+	 * @todo re-implement with Fluent
252
+	 */
253
+	public function getAvailableTranslations()
254
+	{
255
+		if (!class_exists('Translatable')) {
256
+			return false;
257
+		}
258
+
259
+		$translations = new ArrayList();
260
+		$globalTranslations = Translatable::get_existing_content_languages();
261
+
262
+		foreach ($globalTranslations as $loc => $langName) {
263
+			// Find out the language name in native language.
264
+			$nativeLangName = i18n::get_language_name($loc, true);
265
+			if (!$nativeLangName) {
266
+				$nativeLangName = i18n::get_language_name(i18n::get_lang_from_locale($loc), true);
267
+			}
268
+			if (!$nativeLangName) {
269
+				// Fall back to the locale name.
270
+				$nativeLangName = $langName;
271
+			}
272
+
273
+			// Eliminate the part in brackets (e.g. [mandarin])
274
+			$nativeLangName = preg_replace('/ *[\(\[].*$/', '', $nativeLangName);
275
+
276
+			// Find out the link to the translated page.
277
+			$link = null;
278
+			$page = $this->getTranslation($loc);
279
+			if ($page) {
280
+				$link = $page->Link();
281
+			}
282
+			if (!$link) {
283
+				// Fall back to the home page
284
+				$link = Translatable::get_homepage_link_by_locale($loc);
285
+			}
286
+			if (!$link) {
287
+				continue;
288
+			}
289
+
290
+			// Assemble the table for the switcher.
291
+			$translations->push(new ArrayData(array(
292
+				'Locale' => i18n::convert_rfc1766($loc),
293
+				'LangName' => $nativeLangName,
294
+				'Link' => $link,
295
+				'Current' => (Translatable::get_current_locale()==$loc)
296
+			)));
297
+		}
298
+
299
+		if ($translations->count()>1) {
300
+			return $translations;
301
+		} else {
302
+			return null;
303
+		}
304
+	}
305
+
306
+	/**
307
+	 * Returns the native language name for the selected locale/language, empty string if Translatable is not available
308
+	 *
309
+	 * @return string
310
+	 * @todo re-implement with Fluent
311
+	 */
312
+	public function getSelectedLanguage()
313
+	{
314
+		if (!class_exists('Translatable')) {
315
+			return '';
316
+		}
317
+
318
+		$language = explode('_', Translatable::get_current_locale());
319
+		$languageCode = array_shift($language);
320
+		$nativeName = i18n::get_language_name($languageCode, true);
321
+
322
+		return $nativeName;
323
+	}
324 324
 }
Please login to merge, or discard this patch.
src/PageTypes/EventPage.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -12,83 +12,83 @@
 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.';
15
+	private static $description = 'Describes an event occurring on a specific date.';
16 16
 
17
-    private static $default_parent = EventHolder::class;
17
+	private static $default_parent = EventHolder::class;
18 18
 
19
-    private static $can_be_root = false;
19
+	private static $can_be_root = false;
20 20
 
21
-    private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png';
21
+	private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png';
22 22
 
23
-    public $pageIcon =  'images/icons/sitetree_images/event_page.png';
23
+	public $pageIcon =  'images/icons/sitetree_images/event_page.png';
24 24
 
25
-    private static $singular_name = 'Event Page';
25
+	private static $singular_name = 'Event Page';
26 26
 
27
-    private static $plural_name = 'Event Pages';
27
+	private static $plural_name = 'Event Pages';
28 28
 
29
-    private static $db = [
30
-        'StartTime' => 'Time',
31
-        'EndTime' => 'Time',
32
-        'Location' => 'Text',
33
-    ];
29
+	private static $db = [
30
+		'StartTime' => 'Time',
31
+		'EndTime' => 'Time',
32
+		'Location' => 'Text',
33
+	];
34 34
 
35
-    private static $table_name = 'EventPage';
35
+	private static $table_name = 'EventPage';
36 36
 
37
-    public function fieldLabels($includerelations = true)
38
-    {
39
-        $labels = parent::fieldLabels($includerelations);
40
-        $labels['StartTime'] = _t('DateUpdatePage.StartTimeFieldLabel', 'Start Time');
41
-        $labels['EndTime'] = _t('DateUpdatePage.EndTimeFieldLabel', 'End Time');
42
-        $labels['Location'] = _t('DateUpdatePage.LocationFieldLabel', 'Location');
37
+	public function fieldLabels($includerelations = true)
38
+	{
39
+		$labels = parent::fieldLabels($includerelations);
40
+		$labels['StartTime'] = _t('DateUpdatePage.StartTimeFieldLabel', 'Start Time');
41
+		$labels['EndTime'] = _t('DateUpdatePage.EndTimeFieldLabel', 'End Time');
42
+		$labels['Location'] = _t('DateUpdatePage.LocationFieldLabel', 'Location');
43 43
 
44
-        return $labels;
45
-    }
44
+		return $labels;
45
+	}
46 46
 
47
-    /**
48
-     * Add the default for the Date being the current day.
49
-     */
50
-    public function populateDefaults()
51
-    {
52
-        if (!isset($this->Date) || $this->Date === null) {
53
-            $this->Date = DBDatetime::now()->Format('y-MM-dd');
54
-        }
47
+	/**
48
+	 * Add the default for the Date being the current day.
49
+	 */
50
+	public function populateDefaults()
51
+	{
52
+		if (!isset($this->Date) || $this->Date === null) {
53
+			$this->Date = DBDatetime::now()->Format('y-MM-dd');
54
+		}
55 55
 
56
-        if (!isset($this->StartTime) || $this->StartTime === null) {
57
-            $this->StartTime = '09:00:00';
58
-        }
56
+		if (!isset($this->StartTime) || $this->StartTime === null) {
57
+			$this->StartTime = '09:00:00';
58
+		}
59 59
 
60
-        if (!isset($this->EndTime) || $this->EndTime === null) {
61
-            $this->EndTime = '17:00:00';
62
-        }
60
+		if (!isset($this->EndTime) || $this->EndTime === null) {
61
+			$this->EndTime = '17:00:00';
62
+		}
63 63
 
64
-        parent::populateDefaults();
65
-    }
64
+		parent::populateDefaults();
65
+	}
66 66
 
67
-    public function getCMSFields()
68
-    {
69
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
70
-            $fields->removeByName('Date');
67
+	public function getCMSFields()
68
+	{
69
+		$this->beforeUpdateCMSFields(function (FieldList $fields) {
70
+			$fields->removeByName('Date');
71 71
 
72
-            $dateTimeFields = array();
72
+			$dateTimeFields = array();
73 73
 
74
-            $dateTimeFields[] = $dateField = DateField::create('Date', 'Date');
75
-            $dateTimeFields[] = $startTimeField = TimeField::create(
76
-                'StartTime',
77
-                '  ' . $this->fieldLabel('StartTime')
78
-            );
79
-            $dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime'));
74
+			$dateTimeFields[] = $dateField = DateField::create('Date', 'Date');
75
+			$dateTimeFields[] = $startTimeField = TimeField::create(
76
+				'StartTime',
77
+				'  ' . $this->fieldLabel('StartTime')
78
+			);
79
+			$dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime'));
80 80
 
81
-            $fields->addFieldsToTab('Root.Main', [
82
-                $dateTimeField = FieldGroup::create('Date and time', $dateTimeFields),
83
-                $locationField = TextareaField::create('Location', $this->fieldLabel('Location'))
84
-            ], 'Abstract');
85
-            $locationField->setRows(4);
86
-        });
87
-        return parent::getCMSFields();
88
-    }
81
+			$fields->addFieldsToTab('Root.Main', [
82
+				$dateTimeField = FieldGroup::create('Date and time', $dateTimeFields),
83
+				$locationField = TextareaField::create('Location', $this->fieldLabel('Location'))
84
+			], 'Abstract');
85
+			$locationField->setRows(4);
86
+		});
87
+		return parent::getCMSFields();
88
+	}
89 89
 
90
-    public function NiceLocation()
91
-    {
92
-        return nl2br(Convert::raw2xml($this->Location), true);
93
-    }
90
+	public function NiceLocation()
91
+	{
92
+		return nl2br(Convert::raw2xml($this->Location), true);
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png';
22 22
 
23
-    public $pageIcon =  'images/icons/sitetree_images/event_page.png';
23
+    public $pageIcon = 'images/icons/sitetree_images/event_page.png';
24 24
 
25 25
     private static $singular_name = 'Event Page';
26 26
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function getCMSFields()
68 68
     {
69
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
69
+        $this->beforeUpdateCMSFields(function(FieldList $fields) {
70 70
             $fields->removeByName('Date');
71 71
 
72 72
             $dateTimeFields = array();
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/Extensions/CwpSearchBoostExtension.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -12,45 +12,45 @@
 block discarded – undo
12 12
 class CwpSearchBoostExtension extends DataExtension
13 13
 {
14 14
 
15
-    /**
16
-     * Quality to boost the 'SearchBoost' field by.
17
-     * Default boost is 2x
18
-     *
19
-     * @config
20
-     * @var string
21
-     */
22
-    private static $search_boost = '2';
23
-
24
-    private static $db = array(
25
-        'SearchBoost' => 'Text'
26
-    );
27
-
28
-    /**
29
-     * Adds boost fields to this page
30
-     *
31
-     * @param FieldList $fields
32
-     */
33
-    public function updateCMSFields(FieldList $fields)
34
-    {
35
-        parent::updateCMSFields($fields);
36
-
37
-        // Rename metafield
38
-        $meta = $fields->fieldByName('Root.Main.Metadata');
39
-        $meta->setTitle(_t('CwpSearchBoostExtension.PAGEINFO', 'Page info and SEO'));
40
-
41
-        $boostTitle = _t('CwpSiteTreeSearchBoost.SearchBoost', 'Boost Keywords');
42
-        $boostNote = _t(
43
-            'CwpSiteTreeSearchBoost.SearchBoostNote',
44
-            '(Only applies to the search results on this site e.g. not on Google search)'
45
-        );
46
-        $boostDescription = _t(
47
-            'CwpSiteTreeSearchBoost.SearchBoostDescription',
48
-            'Enter keywords separated by comma ( , ) for which to boost the ranking of this page '
49
-            . 'within the search results on this site.'
50
-        );
51
-        $boostField = TextareaField::create('SearchBoost', $boostTitle)
52
-            ->setRightTitle($boostNote)
53
-            ->setDescription($boostDescription);
54
-        $fields->insertBefore($boostField, 'MetaDescription');
55
-    }
15
+	/**
16
+	 * Quality to boost the 'SearchBoost' field by.
17
+	 * Default boost is 2x
18
+	 *
19
+	 * @config
20
+	 * @var string
21
+	 */
22
+	private static $search_boost = '2';
23
+
24
+	private static $db = array(
25
+		'SearchBoost' => 'Text'
26
+	);
27
+
28
+	/**
29
+	 * Adds boost fields to this page
30
+	 *
31
+	 * @param FieldList $fields
32
+	 */
33
+	public function updateCMSFields(FieldList $fields)
34
+	{
35
+		parent::updateCMSFields($fields);
36
+
37
+		// Rename metafield
38
+		$meta = $fields->fieldByName('Root.Main.Metadata');
39
+		$meta->setTitle(_t('CwpSearchBoostExtension.PAGEINFO', 'Page info and SEO'));
40
+
41
+		$boostTitle = _t('CwpSiteTreeSearchBoost.SearchBoost', 'Boost Keywords');
42
+		$boostNote = _t(
43
+			'CwpSiteTreeSearchBoost.SearchBoostNote',
44
+			'(Only applies to the search results on this site e.g. not on Google search)'
45
+		);
46
+		$boostDescription = _t(
47
+			'CwpSiteTreeSearchBoost.SearchBoostDescription',
48
+			'Enter keywords separated by comma ( , ) for which to boost the ranking of this page '
49
+			. 'within the search results on this site.'
50
+		);
51
+		$boostField = TextareaField::create('SearchBoost', $boostTitle)
52
+			->setRightTitle($boostNote)
53
+			->setDescription($boostDescription);
54
+		$fields->insertBefore($boostField, 'MetaDescription');
55
+	}
56 56
 }
Please login to merge, or discard this patch.
src/Extensions/CwpSiteTreeFileExtension.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,50 +11,50 @@
 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
-            ReadonlyField::create(
21
-                'BackLinkCount',
22
-                _t('AssetTableField.BACKLINKCOUNT', 'Used on:'),
23
-                $this->owner->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')
24
-            )
25
-            ->addExtraClass('cms-description-toggle')
26
-            ->setDescription($this->BackLinkHTMLList()),
27
-            'LastEdited'
28
-        );
29
-    }
30
-
31
-    /**
32
-     * Generate an HTML list which provides links to where a file is used.
33
-     *
34
-     * @return String
35
-     */
36
-    public function BackLinkHTMLList()
37
-    {
38
-        $html = '<em>' . _t(
39
-            'SiteTreeFileExtension.BACKLINK_LIST_DESCRIPTION',
40
-            'This list shows all pages where the file has been added through a WYSIWYG editor.'
41
-        ) . '</em>';
42
-        $html .= '<ul>';
43
-
44
-        foreach ($this->owner->BackLinkTracking() as $backLink) {
45
-            $listItem = '<li>';
46
-
47
-            // Add the page link
48
-            $listItem .= '<a href="' . $backLink->Link() . '" target="_blank">'
49
-                . Convert::raw2xml($backLink->MenuTitle) . '</a> &ndash; ';
50
-
51
-            // Add the CMS link
52
-            $listItem .= '<a href="' . $backLink->CMSEditLink() . '">'
53
-                . _t('SiteTreeFileExtension.EDIT', 'Edit') . '</a>';
54
-
55
-            $html .= $listItem . '</li>';
56
-        }
57
-
58
-        return $html .= '</ul>';
59
-    }
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
+			ReadonlyField::create(
21
+				'BackLinkCount',
22
+				_t('AssetTableField.BACKLINKCOUNT', 'Used on:'),
23
+				$this->owner->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')
24
+			)
25
+			->addExtraClass('cms-description-toggle')
26
+			->setDescription($this->BackLinkHTMLList()),
27
+			'LastEdited'
28
+		);
29
+	}
30
+
31
+	/**
32
+	 * Generate an HTML list which provides links to where a file is used.
33
+	 *
34
+	 * @return String
35
+	 */
36
+	public function BackLinkHTMLList()
37
+	{
38
+		$html = '<em>' . _t(
39
+			'SiteTreeFileExtension.BACKLINK_LIST_DESCRIPTION',
40
+			'This list shows all pages where the file has been added through a WYSIWYG editor.'
41
+		) . '</em>';
42
+		$html .= '<ul>';
43
+
44
+		foreach ($this->owner->BackLinkTracking() as $backLink) {
45
+			$listItem = '<li>';
46
+
47
+			// Add the page link
48
+			$listItem .= '<a href="' . $backLink->Link() . '" target="_blank">'
49
+				. Convert::raw2xml($backLink->MenuTitle) . '</a> &ndash; ';
50
+
51
+			// Add the CMS link
52
+			$listItem .= '<a href="' . $backLink->CMSEditLink() . '">'
53
+				. _t('SiteTreeFileExtension.EDIT', 'Edit') . '</a>';
54
+
55
+			$html .= $listItem . '</li>';
56
+		}
57
+
58
+		return $html .= '</ul>';
59
+	}
60 60
 }
Please login to merge, or discard this patch.