Passed
Push — develop ( 319bd8...330c7a )
by Neill
16:41 queued 15s
created

DateTime::getComponentDetails()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 * @link http://www.newicon.net/neon
4
 * @copyright Copyright (c) 21/09/2016 Newicon Ltd
5
 * @license http://www.newicon.net/neon/license/
6
 */
7
8
namespace neon\core\form\fields\el;
9
10
use neon\core\form\fields\Field;
11
use neon\core\form\fields\el\assets\ElAsset;
12
use neon\core\helpers\Html;
13
14
class DateTime extends Field
15
{
16
	/**
17
	 * The DDS data type to store the value of the field
18
	 * @var string
19
	 */
20
	public $ddsDataType = 'datetime';
21
22
	/**
23
	 * @inheritdoc
24
	 */
25
	public function registerScripts($view)
26
	{
27
		ElAsset::register($view);
28
	}
29
30
	/**
31
	 * @inheritdoc
32
	 */
33
	public function getProperties()
34
	{
35
		return array_merge(parent::getProperties(), ['format']);
36
	}
37
38
	/**
39
	 * Get the picker format
40
	 * @return string
41
	 */
42
	public function getFormat()
43
	{
44
		return neon()->formatter->datetimeFormat;
45
	}
46
47
	/**
48
	 * @inheritdoc
49
	 */
50
	public function getValueDisplay($context='')
51
	{
52
		return neon()->formatter->asDatetime($this->getValue());
53
	}
54
55
	/**
56
	 * @inheritdoc
57
	 */
58
	public function getComponentDetails()
59
	{
60
		return [
61
			'label' => 'El Date Time', 'group' => 'Date & Time', 'icon' => 'fa fa-calendar-o', 'order' => 360,
62
		];
63
	}
64
}