How would I add custom attributes into Zend Framework 2 navigation?
I know I can add id or class -> but that\'s about it....
1) How would I add data-test=\'bla
In addition to jmbertucci comment
exсess caret tag in label which cause problem with:
To prevent adding tag caret to label you can add support of this parameter at menu config. You should
Go to
src\Application\View\Helper\NewMenu.php
protected function renderNormalMenu()
/// add 4th parameter $page->get('caret')
$html .= $myIndent . ' - ' . PHP_EOL .
$myIndent . ' ' .
$this->htmlify($page, $escapeLabels, $addClassToListItem, $page->get('caret')) . PHP_EOL;
public function htmlify()
} else {
$html .= $label;
}
//// add this if
if($caret === true){
$html .= '';
}
$html .= '' . $element . '>';
Now you can use it:
array(
'label' => 'Some label',
'caret' => true,
'route' => 'someroute',
'wrapClass' => 'dropdown',
'class' => 'dropdown-toggle',
ps . jmbertucci, you are the Man.