Composite data structure#42
Conversation
|
Nice job! Why /src/ instead of /classes/? :) It will be nice if you'll add additional classes like product_ID, category_ID etc. |
|
@kpodemski Regarding additionnal attributes, I would prefer using data attributes, like: <li data-type="category" data-id="1">...</li>But this is not the goal of this PR. In any case it allows the theme developer to entirely modify the HTML, so at least it is possible. |
|
How you'll check that data-type is category? We don't have such a information in |
|
Yes, you can do |
|
Oh, yes, ok, you're right 👍 |
060c78d to
7cd85ff
Compare
There was a problem hiding this comment.
Order of arguments in assertions should be "expected" then "actual", not "actual" then "expected". It's easy to remember, it's reverse alphabetical order ;)
|
This looks nice, but now feat/starter-theme is out of sync :) We should forward-port your back-port. |
7cd85ff to
077f353
Compare
|
Yes and remove the search feature again, then re-do the caching part (If I'm not mistaken, blocktopmenu caches the rendered HTML, which includes the class that marks the active page. I think it is better to cache the structure of the menu and decorate it with the "active" flag on the appropriate nodes at page load, which is what I did on feat/starter-theme). But I like the visitor and iterator stuff so it is worth it. |
Hello,
As agreed with @djfm, I sort of backported this branch to be retrocompatible: https://github.com/PrestaShop/blocktopmenu/commits/feat/starter-theme
This introduces a composite data structure for the menu items: now theme developers can completely redefine the HTML structure of the menu using Smarty.
To keep things retrocompatible, the
$MENUvariable is still assigned, usingSuperfishNodeVisitorto replicate the legacy behavior.I still need to make a few adjustments, but please start reviewing.