How to register a class tag?

0 like 0 dislike
10 views
Good time of day.
Tell me why my class for the tag does not reach the view function.
In this part of the code is prescribed configuration for menu items.
'navigation' => [ 'Application\avigation\\MainNavigation' => [ 'application' => [ /** * Set options for the 'ul'-element. * For correct set - page must have the most lowest order number (e.g. -100). */ 'ul' => ['class' => 'navbar-nav align-content-between'], 'li' => ['class' => 'nav-item m-auto'], /** Set attributes for 'a'-element. */ 'a' => ['class' => 'nav-link'], 'label' => 'Main', /** Set options for an element. */ 'order' => 10, 'route' => 'home', 'action' => 'index', 'controller' => Controller\\IndexController::class, ],


And this part of code responsible for processing the tag

public function htmlify(AbstractPage $page, $escapeLabel = true, $addClassToListItem = false) { // get attribs for element $attribs = [ 'id' => $page->getId(), 'title' => $this->translate($page->getTitle(), $page->getTextDomain()), ]; /** * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Begin fork ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * @since 18:37 30.10.2016 */ // add additional attributes $attr = $page->get('attr'); if(is_array($attr)){ $attribs = $attribs + $attr; }; /** * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End fork ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ if ($addClassToListItem === false) { $attribs['class'] = $page->getClass(); } // does page have a href? $href = $page->getHref(); if ($href) { $element = 'a'; $attribs['href'] = $href; $attribs['target'] = $page->getTarget(); } else { $element = 'span'; } $html = '<'. $element . $this->htmlAttribs($attribs) . '>'; $label = $this->translate($page->getLabel(), $page->getTextDomain()); if ($escapeLabel === true) { /** @var \\Zend\\View\\Helper\\EscapeHtml $escaper */ $escaper = $this->view->plugin('escapeHtml'); $html .= $escaper($label); } else { $html .= $label; } $html .= '</'. $element . '>'; return $html; }
by | 10 views

1 Answer

0 like 0 dislike
I think you need to do
$addClassToListItem = true
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
asked Apr 9, 2019 by Isolution666
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked May 21, 2019 by dupre
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
33,869 users