Source for file TMenuItem.php
Documentation is available at TMenuItem.php
namespace
Adianti \
Widget \
Menu ;
use
Adianti \
Widget \
Menu \
TMenu ;
use
Adianti \
Widget \
Util \
TImage ;
* @author Pablo Dall'Oglio
* @copyright Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
* @license http://www.adianti.com.br/framework-license
private $menu_transformer ;
* @param $label The menu label
* @param $action The menu action
* @param $image The menu image
public function __construct ( $label , $action , $image =
NULL , $level =
0 , $menu_transformer =
null )
$this -> linkClass =
'dropdown-toggle' ;
$this -> menu_transformer =
$menu_transformer ;
$this -> linkClass =
$class ;
* Define the submenu for the item
* @param $menu A TMenu object
public function setMenu ( TMenu $menu )
$this -> { 'class' } =
'dropdown-submenu' ;
$this -> classLink =
$class ;
$this -> classIcon =
$class ;
* Shows the widget at the screen
// Controll if menu.xml contains a short url e.g. \home -> back slash is the char controll
if ( substr ( $action , 0 , 1 ) ==
'\\' )
$this -> link -> { 'generator' } =
'adianti' ;
elseif (( substr ( $action , 0 , 7 ) ==
'http://' ) or ( substr ( $action , 0 , 8 ) ==
'https://' ))
$this -> link -> { 'href' } =
$action ;
$this -> link -> { 'target' } =
'_blank' ;
$this -> link -> { 'href' } =
$router ( " class={$action } " , true ) ;
$this -> link -> { 'href' } =
" index.php?class={$action } " ;
$this -> link -> { 'generator' } =
'adianti' ;
$this -> link -> { 'href' } =
'#' ;
$image =
new TImage ( $this -> image ) ;
$image -> { 'class' } .=
" {$this -> classIcon } " ;
$label =
new TElement ( $this -> tagLabel ??
'span' ) ;
if ( substr ( $this -> label , 0 , 3 ) ==
'_t{' )
$label -> add ( $this -> label ) ;
if ( ! empty ( $this -> label ))
$this -> link -> { 'class' } =
$this -> classLink ;
if ( $this -> menu instanceof
TMenu )
$this -> link -> { 'class' } =
$this -> linkClass ;
if ( strstr ( $this -> linkClass , 'dropdown' ))
$this -> link -> { 'data-toggle' } =
"dropdown" ;
$caret -> { 'class' } =
'caret' ;
if ( ! empty ( $this -> menu_transformer ))
parent :: add ( $this -> menu ) ;