Expand my Community achievements bar.

SOLVED

Correct Method to add a CF to a Custom Component

Avatar

Level 3

I've been looking around and figured I'd ask the collective knowledge base here on the best way to add a CF to a Custom Component for AEM 6.3.

Is it better to the proxy the WCM Core Component Extension CF then just copy/extend it's dialog etc.. or is it better to dam/cfm/components/cfpicker to a dialog and just customize how the CF itself is then displayed in the component?  Or better yet is there some way to reference the entire CF dialog as a reference within my current component dialog?

Also if there are any examples out there, I haven't been able to find any good ones showing this type of integration.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

you can check the existing foundation CF component at /libs/dam/cfm/components/contentfragment

and extract the java and html part from there and use inside your component.



Arun Patidar

View solution in original post

4 Replies

Avatar

Level 10

Content Fragments act like a component - as discussed here - -Adobe Experience Manager Help | Working with Adobe Experience Manager Content Fragments

As you can see - you drag a content fragment onto an AEM page - like other AEM components- such as a custom HTL component.

Avatar

Level 10

Also - discussed here: Page Authoring with Content Fragments

If you want to develop a custom component - then you should not use Content Fragments. You should use Sling Models and HTL.

Avatar

Level 3

Let me clarify a bit further then.  We're developing a custom component in HTL.  We already have our dialog setup, and the component displaying fine on our pages.  What we'd like to do is add the ability for an Author to select a Content Fragment when using our new component to display some content within the component.

My question is, what is the easiest way to add the ability for an Author to select a CF in the dialog, and what's the easiest way to display the select CF within the component.

After looking at the WCM Core Component v1 version I see there's a specific /cfpicker resourceType, but the display from the WCM Core's contentfragment.html file seems rather complex.

Avatar

Correct answer by
Community Advisor

Hi,

you can check the existing foundation CF component at /libs/dam/cfm/components/contentfragment

and extract the java and html part from there and use inside your component.



Arun Patidar