Hi All,
I was trying to add multifield in the OOTB Navigation Component to facilitate the easy addition of External URLs.
This use case helps our authors to update a few nav links from time to time. We are currently using the Shadow Site procedure, but want more flexibility
Steps I followed:
1. Created a Model class Implementing Navigation following the Sling Delegation Pattern.
@Model(
adaptables = SlingHttpServletRequest.class,
adapters = Navigation.class,
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL,
resourceType = "myproject/components/navigation"
)
public class myNavModel implements Navigation {
@Self
(type = ResourceSuperType.class)
private Navigation navigation;
2. Since I want to get Multifield values, I created a class for it & traversed those links and titles into my Model Class.
3. Now I have original Navigation Items and Multifield Links both in my Model Class.
4. Since OOTB navigation items were unmodifiable lists.
5. I created a NavigationItem class to help me build nav items for my authored links.
private NavigationItem newNavigationItem(String url, String name) {
NavigationItem item = new NavigationItemImpl(url, name);
return item;
}
/*
NavigationItemImpl-- is my implementation of OOTB- internal- NavigationItemImpl class, since we can't extend it.
*/
NavigationItemImpl-- is my implementation of OOTB- internal- NavigationItemImpl class, since we can't extend it.
6. I can see my authored links & original links both in the new List.
However, upon calling on the page, Sightly throws an error "org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException " and sometimes "UnsupportedOperationException".
Please help me solve this further.
Kindly help me to solve this issue.
Thanks,
Aditya Chabuku
Thanks,
Aditya Chabuku