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

Date::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\Converter;
13
use neon\core\helpers\Html;
14
15
class Date extends Field
16
{
17
	/**
18
	 * The DDS data type to store the value of the field
19
	 * @var string
20
	 */
21
	public $ddsDataType = 'date';
22
23
	/**
24
	 * @inheritdoc
25
	 */
26
	public function getProperties()
27
	{
28
		return array_merge(parent::getProperties(), ['format']);
29
	}
30
31
	/**
32
	 * @inheritdoc
33
	 */
34
	public function getFilterField()
35
	{
36
		return [
37
			'class' => 'neon\core\form\fields\el\DateRange'
38
		];
39
	}
40
41
	/**
42
	 * Get the picker format
43
	 * @return string
44
	 */
45
	public function getFormat()
46
	{
47
		return neon()->formatter->dateFormat;
48
	}
49
50
	/**
51
	 * @inheritdoc
52
	 */
53
	public function getValueDisplay($context='')
54
	{
55
		return neon()->formatter->asDate($this->getValue());
56
	}
57
58
	/**
59
	 * @inheritdoc
60
	 */
61
	public function registerScripts($view)
62
	{
63
		ElAsset::register($view);
64
	}
65
66
	/**
67
	 * @inheritdoc
68
	 */
69
	public function getComponentDetails()
70
	{
71
		return [
72
			'label' => 'El Date', 'group' => 'Date & Time', 'icon' => 'fa fa-calendar-o', 'order' => 350,
73
		];
74
	}
75
}