phpMv
-UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
MenuItemTrait.php
Go to the documentation of this file.
1
<?php
2
namespace
Ajax\semantic\html\base\traits
;
3
4
use
Ajax\service\JArray
;
5
use
Ajax\service\JString
;
6
use
Ajax\semantic\html\elements\HtmlInput
;
7
use
Ajax\semantic\html\base\constants\Direction
;
8
use
Ajax\semantic\html\content\HtmlDropdownItem
;
9
use
Ajax\semantic\html\content\HtmlMenuItem
;
10
17
class
MenuItemTrait
{
18
abstract
public
function
addToProperty
($name, $value, $separator=
" "
);
19
abstract
public
function
setClass
($classNames);
20
abstract
public
function
addIcon
($icon, $before=
true
);
21
22
public
function
setContent
($content){
23
if
($content===
"-"
){
24
$this->
asDivider
();
25
}elseif($content===
"-search-"
){
26
$values=\explode(
","
,$content,-1);
27
$this->
asSearchInput
(JArray::getDefaultValue($values, 0,
"Search..."
),JArray::getDefaultValue($values, 1,
"search"
));
28
}elseif(JString::startswith($content,
"-"
)){
29
$content=\ltrim($content,
"-"
);
30
$this->
asHeader
($content);
31
}
else
32
parent::setContent($content);
33
return
$this;
34
}
35
41
public
function
asSearchInput
($placeholder=NULL,$icon=NULL){
42
$this->
setClass
(
"ui icon search input"
);
43
$input=
new
HtmlInput
(
"search-"
.$this->identifier);
44
if
(isset($placeholder))
45
$input->setProperty(
"placeholder"
, $placeholder);
46
$this->content=$input;
47
if
(isset($icon))
48
$this->
addIcon
($icon);
49
return
$this;
50
}
51
55
public
function
asDivider
(){
56
$this->content=NULL;
57
$this->tagName=
"div"
;
58
$this->
setClass
(
"divider"
);
59
return
$this;
60
}
61
67
public
function
asHeader
($caption=NULL,$icon=NULL){
68
$this->
setClass
(
"header"
);
69
$this->tagName=
"div"
;
70
$this->content=$caption;
71
if
(isset($icon))
72
$this->
addIcon
($icon,
Direction::LEFT
);
73
return
$this;
74
}
75
76
public
function
setPosition
($direction){
77
$this->
addToProperty
(
"class"
,$direction);
78
}
79
}
Ajax\semantic\html\base\constants\Direction
Definition
Direction.php:4
Ajax\semantic\html\base\constants\Direction\LEFT
const LEFT
Definition
Direction.php:5
Ajax\semantic\html\base\traits\MenuItemTrait
Definition
MenuItemTrait.php:17
Ajax\semantic\html\base\traits\MenuItemTrait\setContent
setContent($content)
Definition
MenuItemTrait.php:22
Ajax\semantic\html\base\traits\MenuItemTrait\setClass
setClass($classNames)
Ajax\semantic\html\base\traits\MenuItemTrait\addIcon
addIcon($icon, $before=true)
Ajax\semantic\html\base\traits\MenuItemTrait\setPosition
setPosition($direction)
Definition
MenuItemTrait.php:76
Ajax\semantic\html\base\traits\MenuItemTrait\asDivider
asDivider()
Definition
MenuItemTrait.php:55
Ajax\semantic\html\base\traits\MenuItemTrait\asHeader
asHeader($caption=NULL, $icon=NULL)
Definition
MenuItemTrait.php:67
Ajax\semantic\html\base\traits\MenuItemTrait\addToProperty
addToProperty($name, $value, $separator=" ")
Ajax\semantic\html\base\traits\MenuItemTrait\asSearchInput
asSearchInput($placeholder=NULL, $icon=NULL)
Definition
MenuItemTrait.php:41
Ajax\semantic\html\content\HtmlDropdownItem
Definition
HtmlDropdownItem.php:14
Ajax\semantic\html\content\HtmlMenuItem
Definition
HtmlMenuItem.php:9
Ajax\semantic\html\elements\HtmlInput
Definition
HtmlInput.php:15
Ajax\service\JArray
Definition
JArray.php:4
Ajax\service\JString
Definition
JString.php:4
Ajax\semantic\html\base\traits
Definition
AttachedTrait.php:3
Ajax
semantic
html
base
traits
MenuItemTrait.php
Generated on Sun Dec 10 2023 16:16:04 for
phpMv-UI
by
doxygen
1.9.8