TbHtml::pagerLink PHP Method

    public static function pagerLink($label, $url, $htmlOptions = array())
    {
        $linkOptions = TbArray::popValue('linkOptions', $htmlOptions, array());
        if (TbArray::popValue('previous', $htmlOptions, false)) {
            self::addCssClass('previous', $htmlOptions);
        }
        if (TbArray::popValue('next', $htmlOptions, false)) {
            self::addCssClass('next', $htmlOptions);
        }
        if (TbArray::popValue('disabled', $htmlOptions, false)) {
            self::addCssClass('disabled', $htmlOptions);
        }
        $content = self::link($label, $url, $linkOptions);
        return self::tag('li', $htmlOptions, $content);
    }

Usage Example

Exemplo n.º 1
0
 public function testPagerLink()
 {
     $I = $this->codeGuy;
     $html = TbHtml::pagerLink('Link', '#', array('class' => 'item', 'linkOptions' => array('class' => 'link'), 'disabled' => true));
     $li = $I->createNode($html, 'li');
     $I->seeNodeCssClass($li, 'item disabled');
     $a = $li->filter('a');
     $I->seeNodeCssClass($a, 'link');
     $I->seeNodeAttribute($a, 'href', '#');
     $I->seeNodeText($a, 'Link');
     $html = TbHtml::pagerLink('Previous', '#', array('previous' => true));
     $li = $I->createNode($html, 'li.previous');
     $a = $li->filter('a');
     $I->seeNodeAttribute($a, 'href', '#');
     $I->seeNodeText($a, 'Previous');
     $html = TbHtml::pagerLink('Next', '#', array('next' => true));
     $li = $I->createNode($html, 'li.next');
     $a = $li->filter('a');
     $I->seeNodeAttribute($a, 'href', '#');
     $I->seeNodeText($a, 'Next');
 }
TbHtml