caffeinated / menus

:pushpin: Menu generator package for the Laravel framework
https://caffeinatedpackages.com
132 stars 59 forks source link

Conflict between Attributes and Active Classes #60

Closed edumejia30 closed 8 years ago

edumejia30 commented 9 years ago

My menu is loaded from a database, and I integrated it into your plugin and all was working fine with your bootstrap solution, but I have an important issue. I checked the documentation and the source code and I have not found an answer. When I include an attribute class, the active class is not shown, just the attribute class that overrides the active class.

And from the problem I mentioned before, I also found another suggestion (not issue). If I include two class attributes, the second replaces the first one. For example: if(something){ $first_level->attribute('class', 'something'); } if(another thing){ $first_level->attribute('class', 'another'); } This would show just the 'another' class, and delete the 'something' class. Yeah, I should put both in one line with conditions, but it would be easier and more flexible if attributes of the same name could accumulate instead of replacing the values by the new ones for attributes, and the active class.

And another suggestion would be to include an 'isActive' function. This could helped me to solve my last issue, just by using an if($item->isActive){ // add active attribute manually }, but I didn't found that function either.