TbHtml::menuLink PHP Method

    public static function menuLink($label, $url, $htmlOptions = array())
    {
        TbArray::defaultValue('role', 'menuitem', $htmlOptions);
        $linkOptions = TbArray::popValue('linkOptions', $htmlOptions, array());
        $content = self::link($label, $url, $linkOptions);
        return self::tag('li', $htmlOptions, $content);
    }

Usage Example

Example #1
0
 public function testMenuLink()
 {
     $I = $this->codeGuy;
     $html = TbHtml::menuLink('Link', '#', array('class' => 'item', 'linkOptions' => array('class' => 'link')));
     $li = $I->createNode($html, 'li');
     $I->seeNodeCssClass($li, 'item');
     $a = $li->filter('a');
     $I->seeNodeCssClass($a, 'link');
     $I->seeNodeAttribute($a, 'href', '#');
     $I->seeNodeText($a, 'Link');
 }
TbHtml