Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

AEM - Select Experience Fragments in RTE (Rich Text Editor) Link Plugin | AEM Community Blog Seeding




AEM - Select Experience Fragments in RTE (Rich Text Editor) Link Plugin by Sreekanth Choudry Nalabotu


In the Path Field picker of RTE Link Plugin, Experience Fragments are NOT shown by default. This extension is to adjust /libs/cq/gui/content/linkpathfield/picker/views/column/datasource configuration synthetically during runtime and set exclude attribute to none so XFs can be selected and linked...

Create a filter apps.experienceaem.sites.core.filters.LinkPathFieldFilter to adjust the exclude configuration during request...

package apps.experienceaem.sites.core.filters;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jcr.Node;
import javax.servlet.*;
import java.io.IOException;
import java.util.Map;

service = Filter.class,
immediate = true,
name = "Experience AEM Link path field Filter",
property = {
Constants.SERVICE_RANKING + ":Integer=-99",
public class LinkPathFieldFilter implements Filter {
private static Logger logger = LoggerFactory.getLogger(LinkPathFieldFilter.class);

public static String EXCLUDE = "exclude";
public static String EXCLUDE_NONE = "none";
public static String LINK_PATH_DS = "/libs/cq/gui/content/linkpathfield/picker/views/column/datasource";

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request;

Resource linkPathDSRes = slingRequest.getResourceResolver().getResource(LINK_PATH_DS);
linkPathDSRes.adaptTo(Node.class).setProperty(EXCLUDE, EXCLUDE_NONE);//set property for this request, not saved to CRX
}catch(Exception e){
logger.error("Error overriding property 'exclude'", e);

chain.doFilter(slingRequest, response);

public void init(FilterConfig filterConfig) throws ServletException {

public void destroy() {

Read Full Blog

AEM - Select Experience Fragments in RTE (Rich Text Editor) Link Plugin


Please use this thread to ask the related questions.

Kautuk Sahni
0 Replies