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

Submit   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 49
ccs 0
cts 22
cp 0
rs 10
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getProperties() 0 3 1
A setValue() 0 5 3
A registerScripts() 0 3 1
A setValueFromDb() 0 3 1
A getComponentDetails() 0 4 1
1
<?php
2
/**
3
 * @link http://www.newicon.net/neon
4
 * @copyright Copyright (c) 2016 Newicon Ltd
5
 * @license http://www.newicon.net/neon/license
6
 */
7
8
namespace neon\core\form\fields;
9
10
use neon\core\form\fields\el\assets\ElAsset;
11
use neon\core\form\fields\Field;
12
use neon\core\helpers\Html;
13
14
/**
15
 * Class Text
16
 * @package neon\core\form
17
 */
18
class Submit extends Field
19
{
20
	/**
21
	 * Label to apply to the button when the form is processing the request. e.g. submitting the form
22
	 * @var string
23
	 */
24
	public $submittingLabel = 'Submitting...';
25
26
	/**
27
	 * @inheritdoc
28
	 */
29
	public function getProperties()
30
	{
31
		return array_merge(parent::getProperties(), ['submittingLabel']);
32
	}
33
34
	/**
35
	 * @inheritdoc
36
	 */
37
	public function registerScripts($view)
38
	{
39
		ElAsset::register($view);
40
	}
41
42
	/**
43
	 * @inheritdoc
44
	 */
45
	public function setValueFromDb($value)
46
	{
47
		parent::setValueFromDb(false);
48
	}
49
50
	/**
51
	 * @inheritdoc
52
	 */
53
	public function setValue($value)
54
	{
55
		if ($value === 'true' || $value === true)
56
			$this->getForm()->submittedButton=$this->getName();
57
		return $this;
58
	}
59
60
	/**
61
	 * @inheritdoc
62
	 */
63
	public function getComponentDetails()
64
	{
65
		return [
66
			'label' => 'Submit', 'group' => 'Form Only', 'icon' => 'fa fa-calendar-o', 'order' => 910,
67
		];
68
	}
69
}