Closed mostafaznv closed 8 years ago
Hi @mostafaznv
It's important missing. I will add it's features as soon possible.
hi @atayahmet Thanks a lot... I am waiting for new version
Hi @mostafaznv
You can already add to < li >
attributes.
<?php
Menu::active(function($li, $href, $label) {
$li->addAttr('class', 'active')->addAttr('data-label', $label);
})->renderAsHtml();
Please check: https://github.com/atayahmet/laravel-nestable#active
I must now add the ability to add attribute feature < ul >
yes i used that yesterday but the problem is that we can't add dynamic classes to < li >
i have a function for generate nav-menu dynamically, and i have multiple menus with different classes
<?php
$someClass = 'active-state';
Menu::active(function($li, $href, $label) use ($someClass) {
$li->addAttr('class', $someClass);
})->renderAsHtml();
Did you try in this way? @mostafaznv
thanks, worked fine ...
worked
but only for parent <ul>
something like this:
<ul class="ul-class">
<li class="li-class"><a href="#">item</a></li>
<li class="li-class">
<a href="#">item</a>
>>>>>>>>>> <ul> <<<<<<<<<<<<
<li class="li-class"><a href="#">item</a></li>
<li class="li-class"><a href="#">item</a></li>
</ul>
</li>
</ul>
i can add attributes to all ul
with HTML DOM
but i think it's a bad idea...
i think it's better to add attributes to all nested tags through the package
thanks dear ahmet
nested ul
fixed
but i lost li
attributes
it seems this code doesn't work:
->active(function($li, $href, $label) use ($liClass) {
$li->addAttr('class', $liClass);
})
Hi @mostafaznv
it fixed. please try again.
wow ... thanks dear @atayahmet
please don't close this thread. i will test the package today and tomorrow and i will report bugs (if i found)
i think your package is the best nested category package for laravel now
thanks @atayahmet i worked with the package and it seems everything are good
Hi @mostafaznv
I'm glad to work smoothly. Your welcome.
hi dear @atayahmet i want to add some attributes to
<ul>
but i didn't see anything in documentationis it possible in this version? if it's not, how i can add this feature to the package?
edit: i solved this by modifing
NestableService.php
(only worked for parentul
) i changed renderAsHtml by these codes:anyway i'm waiting for your update for this package ... i need attributes for
<ul>
and<li>
i have a function to generateul
li
for nav-menu so i need dynamic attributes for nestedul
andli