phpMv
-UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
IconTrait.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ajax\semantic\html\base\traits
;
4
5
use
Ajax\semantic\html\elements\HtmlIcon
;
6
use
Ajax\semantic\html\base\constants\Direction
;
7
8
14
class
IconTrait
{
15
private
$_hasIcon
=
false
;
16
17
abstract
protected
function
addToPropertyCtrl
($name, $value, $typeCtrl);
18
abstract
public
function
addContent
($content,$before=
false
);
19
20
public
function
addIcon
($icon,$direction=
Direction::LEFT
){
21
if
($this->_hasIcon===
false
){
22
$iconO=$icon;
23
if
(\is_string($icon)){
24
$iconO=
new
HtmlIcon
(
"icon-"
.$this->identifier, $icon);
25
}
26
$this->
addToPropertyCtrl
(
"class"
, $direction.
" icon"
,
Direction::getConstantValues
(
"icon"
));
27
$this->
addContent
($iconO,$direction===
Direction::LEFT
);
28
$this->_hasIcon=
true
;
29
}
else
{
30
$iconO=$this->
getIcon
();
31
$iconO->setIcon($icon);
32
$this->
addToPropertyCtrl
(
"class"
, $direction.
" icon"
,
Direction::getConstantValues
(
"icon"
));
33
}
34
return
$iconO;
35
}
36
37
public
function
getIcon
(){
38
if
(\is_array($this->content)){
39
foreach
($this->content as $item){
40
if
($item instanceof
HtmlIcon
)
41
return
$item;
42
}
43
}
44
}
45
}
Ajax\common\BaseEnum\getConstantValues
static getConstantValues($postFix="", $prefixBefore=false)
Definition
BaseEnum.php:29
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\IconTrait
Definition
IconTrait.php:14
Ajax\semantic\html\base\traits\IconTrait\$_hasIcon
$_hasIcon
Definition
IconTrait.php:15
Ajax\semantic\html\base\traits\IconTrait\addIcon
addIcon($icon, $direction=Direction::LEFT)
Definition
IconTrait.php:20
Ajax\semantic\html\base\traits\IconTrait\getIcon
getIcon()
Definition
IconTrait.php:37
Ajax\semantic\html\base\traits\IconTrait\addToPropertyCtrl
addToPropertyCtrl($name, $value, $typeCtrl)
Ajax\semantic\html\base\traits\IconTrait\addContent
addContent($content, $before=false)
Ajax\semantic\html\elements\HtmlIcon
Semantic Icon component.
Definition
HtmlIcon.php:14
Ajax\semantic\html\base\traits
Definition
AttachedTrait.php:3
Ajax
semantic
html
base
traits
IconTrait.php
Generated on Sun Dec 10 2023 16:16:04 for
phpMv-UI
by
doxygen
1.9.8