Passed
Push — master ( 3d3660...f6786e )
by Jean-Christophe
01:38
created

Dropdown::setShowOnFocus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Ajax\semantic\components;
3
4
use Ajax\JsUtils;
5
6
class Dropdown extends SimpleSemExtComponent {
7
8
	public function __construct(JsUtils $js) {
9
		parent::__construct($js);
10
		$this->uiName = "dropdown";
11
	}
12
13
	/**
14
	 * Sets a default action to occur
15
	 *
16
	 * @param string $action
17
	 *        	one of "select","auto","activate","combo","nothing","hide"
18
	 * @return \Ajax\semantic\components\Dropdown
19
	 */
20
	public function setAction($action) {
21
		return $this->setParamCtrl("action", $action, array(
22
			"select",
23
			"auto",
24
			"activate",
25
			"combo",
26
			"nothing",
27
			"hide"
28
		));
29
	}
30
31
	/**
32
	 * Define the event which trigger dropdown
33
	 *
34
	 * @param string $event
35
	 *        	Event used to trigger dropdown (Hover, Click, Custom Event)
36
	 * @return \Ajax\semantic\components\Dropdown
37
	 */
38
	public function setOn($event) {
39
		return $this->setParam("on", $event);
40
	}
41
42
	public function setFullTextSearch($value) {
43
		return $this->setParam("fullTextSearch", $value);
44
	}
45
46
	public function setShowOnFocus($value) {
47
		return $this->setParam("showOnFocus", $value);
48
	}
49
50
	public function setAllowAdditions($value) {
51
		return $this->setParam("allowAdditions", $value);
52
	}
53
54
	public function setClearable($value) {
55
		return $this->setParam("clearable", $value);
56
	}
57
58
	public function setOnAdd($value) {
59
		$this->params["onAdd"] = "%function(addedValue, addedText, \$addedChoice){" . $value . "}%";
60
	}
61
62
	public function setOnRemove($value) {
63
		$this->params["onRemove"] = "%function(removedValue, removedText, \$removedChoice){" . $value . "}%";
64
	}
65
}
66