1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax\semantic\html\base\traits; |
4
|
|
|
|
5
|
|
|
use Ajax\semantic\html\base\constants\Size; |
6
|
|
|
use Ajax\semantic\html\base\constants\Color; |
7
|
|
|
trait BaseTrait { |
8
|
|
|
protected $_variations=[]; |
9
|
|
|
protected $_states=[]; |
10
|
|
|
protected $_baseClass; |
11
|
|
|
|
12
|
|
|
protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
13
|
|
|
protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
14
|
|
|
public abstract function addToProperty($name, $value, $separator=" "); |
15
|
|
|
|
16
|
|
|
public function addVariation($variation){ |
17
|
|
|
return $this->addToPropertyCtrl("class", $variation, $this->_variations); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function addState($state){ |
21
|
|
|
return $this->addToPropertyCtrl("class", $state, $this->_states); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function setVariation($variation){ |
25
|
|
|
$this->setPropertyCtrl("class", $variation, $this->_variations); |
26
|
|
|
return $this->addToProperty("class", $this->_baseClass); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function setState($state){ |
30
|
|
|
$this->setPropertyCtrl("class", $state, $this->_states); |
31
|
|
|
return $this->addToProperty("class", $this->_baseClass); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* {@inheritDoc} |
36
|
|
|
* @see \Ajax\common\html\HtmlSingleElement::setSize() |
37
|
|
|
*/ |
38
|
|
|
public function setSize($size){ |
39
|
|
|
return $this->addToPropertyCtrl("class", $size, Size::getConstants()); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* show it is currently unable to be interacted with |
44
|
|
|
* @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
45
|
|
|
*/ |
46
|
|
|
public function setDisabled(){ |
47
|
|
|
return $this->addToProperty("class", "disabled"); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $color |
52
|
|
|
* @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
53
|
|
|
*/ |
54
|
|
|
public function setColor($color){ |
55
|
|
|
return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
60
|
|
|
*/ |
61
|
|
|
public function setFluid(){ |
62
|
|
|
return $this->addToProperty("class", "fluid"); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* can be formatted to appear on dark backgrounds |
67
|
|
|
*/ |
68
|
|
|
public function setInverted(){ |
69
|
|
|
return $this->addToProperty("class", "inverted"); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function setCircular(){ |
73
|
|
|
return $this->addToProperty("class", "circular"); |
74
|
|
|
} |
75
|
|
|
} |