Passed
Push — master ( d7fd6a...9124ff )
by Robbie
11:58
created

CwpSiteTreeExtension::updateSettingsFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
3
class CwpSiteTreeExtension extends DataExtension
4
{
5
	private static $db = array(
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
6
		'ShowPageUtilities' => 'Boolean(1)'
7
	);
8
9
	private static $defaults = array(
0 ignored issues
show
introduced by
The private property $defaults is not used, and could be removed.
Loading history...
10
		'ShowPageUtilities' => true
11
	);
12
13
	/**
14
	 * Modify the settings for a SiteTree
15
	 *
16
	 * {@inheritDoc}
17
	 *
18
	 * @param FieldList $fields
19
	 */
20
	public function updateSettingsFields(FieldList $fields)
21
	{
22
		$helpText = _t(
23
			'SiteTree.SHOW_PAGE_UTILITIES_HELP',
24
			'You can disable page utilities (print, share, etc) for this page'
25
		);
26
27
		$fields->addFieldsToTab(
28
			'Root.Settings',
29
			array(
30
				LiteralField::create('PageUtilitiesHelp', $helpText),
31
				CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities'))
32
			)
33
		);
34
	}
35
36
	public function updateFieldLabels(&$labels)
37
	{
38
		$labels['ShowPageUtilities'] = _t('SiteTree.SHOW_PAGE_UTILITIES', 'Show page utilities?');
39
	}
40
}
41