Hey guys, i'm new to fanta pager and i've been trying to extend the current functionality of twitter template to add data-attributes to the links. i was wondering is there a better way of doing this ?
class CustomFantaView extends TwitterBootstrap3Template
{
public function page($page)
{
$text = $page;
return $this->pageWithText($page, $text);
}
public function pageWithText($page, $text)
{
$class = null;
return $this->pageWithTextAndClass($page, $text, $class);
}
private function pageWithTextAndClass($page, $text, $class)
{
$href = $this->generateRoute($page);
return $this->linkLi($class, $href, $page, $text);
}
public function previousEnabled($page)
{
$text = $this->option('prev_message');
$class = $this->option('css_prev_class');
return $this->pageWithTextAndClass($page, $text, $class);
}
public function nextEnabled($page)
{
$text = $this->option('next_message');
$class = $this->option('css_next_class');
return $this->pageWithTextAndClass($page, $text, $class);
}
private function linkLi($class, $href, $text, $page)
{
$liClass = $class ? sprintf(' class="%s"', $class) : '';
return sprintf('<li%s><a href="%s" data-page="%s">%s</a></li>', $liClass, $href, $text, $page);
}
}
Hey guys, i'm new to fanta pager and i've been trying to extend the current functionality of twitter template to add data-attributes to the links. i was wondering is there a better way of doing this ?