Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72388

Hybris: How to pass class as a parameter to cms:component?

$
0
0

I've started to learn Hybris and I want to find out how to pass the class as a parameter to a custom CMS Component (for the component's root element).

Let's suppose that in a jsp file named "customNavigationComponent.jsp" I have this piece of code:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="cms" uri="http://hybris.com/tld/cmstags"%>

<c:forEach items="${navigation.entries}" var="navigationLink">
    <div class="custom-component-wrapper">
        <cms:component component="${navigationLink.item}"/>
    </div>
</c:forEach>

And the custom component looks like this:

<a href="${component.url}">
    <div>${component.linkText}</div>
</a>

I would like to understand what I need to do to pass the class navigation-link as a parameter, like this:

<cms:component component="${navigationLink.item}" class="navigation-link"/>

so that the rendered result will be similar to:

<a href="stackoverflow.com" class="navigation-link">
    <div>Lorem Ipsum</div>
</a>

Viewing all articles
Browse latest Browse all 72388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>