Passed
Pull Request — develop ( #58 )
by
unknown
32:22 queued 14:42
created

Submit   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
eloc 8
dl 0
loc 40
rs 10
c 0
b 0
f 0
ccs 0
cts 17
cp 0

4 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
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
}