Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Multifield in content fragment model

Avatar

Level 4

Is it possible to add a multifield to a content fragment model?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Correct - as discussed in the article - they are created on Author.  A component used in a content fragment can have a dialog - where you can use all grainte data types - including MF.

View solution in original post

25 Replies

Avatar

Level 10

Hi,

Yes Scott is correct. Multifield is used to run on author and input the content to the dialog of the component.

It is not used on publish.

Thanks,
Ratna Kumar.

Avatar

Level 4

Maybe I'm mistaking what a content fragment model is, but isn't creating a content fragment an authoring action? If you create a content fragment based on a content fragment model, is this not akin to adding data to the repository via a component's dialog?

Avatar

Level 10

A content fragment once built - runs on Publish. Therefore Granite APIS are not used within them.

Here is a good article on Content Fragments -- Adobe Experience Manager Help | Working with Adobe Experience Manager Content Fragments

Avatar

Level 4

I understand the content fragment runs on Publish, but it's still created in the authoring environment? A content editor wouldn't create it on the publisher, right?

Avatar

Correct answer by
Level 10

Correct - as discussed in the article - they are created on Author.  A component used in a content fragment can have a dialog - where you can use all grainte data types - including MF.

Avatar

Level 4

If that's the case then, I thought a content fragment model is essentially just a dialog for creating the content fragment (in the author).

Avatar

Level 10

If you look at this illustration--

AModel.png

A component can be part of a Content Fragment. That component can have a dialog which is used to populate that component with data.

Therefore a Multifield can be part of the component dialog - which renders content that is displays within the Content Fragment. However - a MF cannot be used within the Fragment itself.

I hope this clear its up.

Avatar

Level 10

Are you referring to overriding the Content Fragment wizard and injecting a Multifield here:

AModel2.png

Avatar

Level 4

Maybe it would be better to give some context to what we are trying to do. At the moment, to create some content, an editor would add a component to a page then populate it with some values via a dialog. The component then renders those variables appropriately.

We may want multiple instances of the same component across our site where the data within those components is the same. At the moment, to do this we would either add the component to each page and configure them individually via a dialog, or we could create one then copy and paste it onto other pages. The problem with these two methods is that if we want to change a value in that repeated component, we need to repeat the work for each instance on each page.

Our intention to improve this process was to separate the dialog and the view in the component from each other. We would create a content fragment as a central source of the data we wanted to display then create a component that we would point to that fragment and render it.

When creating the content fragment, we want the editors to enter data in a structured format (as they would in a dialog) and we identified content fragment models as a way to do that. It's in these models that I was hoping I could add a multifield; as it stands, these are the only field types available:

1345648_pastedImage_2.png

Avatar

Level 10

Just to summarize what i meant - here is a content fragment example - you can build by following: Adobe Experience Manager Help | Working with Adobe Experience Manager Content Fragments

AA44.png

You can see component on the left (in red) and content fragment on the right.

What i meant was you can use a Multi-field in a component dialog that you drop onto a content fragment. That is the only role i see a Multifield playing while using a Content Fragment.

Avatar

Level 2

Hi All,

I have a similar question while creating content fragment model currently we have "single-line-field", "multi-line-field" etc. Is it possible to create another data type similar to multi-field. For example in the fragment model I want to list down N number of links.

Thanks,

Shehjad

Avatar

Level 5

Shehjad,

I am trying to do the same thing. I tried to add a multifield and it doesn't work. All the simple datatypes work just fine, but creating a multifield doesn't seem to work.

Avatar

Level 10

You cannot use a multifield in a fragment. A multifieldis a granite type used on author and typically used in a dialog for a component. A Fragment is a component that renders on Pub. Granite types do not render on Publish.,

Avatar

Level 5

Scott,

I understand what you are saying, but when you want a text field in your model you derived from "granite/ui/components/coral/foundation/form/textfield" and when you want a list of things you would normally use "granite/ui/components/coral/foundation/form/multifield". At the base, this is all just "content". Lets say I want my user to have a content fragment with a title and a list of name value pair's. For example we put a movie and location and times the movie is playing. So,

"Deadpool 2"

2:20 - Atlanta

3:00 - New York

How would you suggest on putting that data in a content fragment?

Avatar

Level 10

If I had that requirement - i would look at developing an AEM HTL component that can render the data to meet my needs. Something along these lines --

Scott's Digital Community: Creating an AEM HTML Template Language movie component

Notice that we use a dialog to collect data and HTL to display the data, I think following this can address your requirement.

Avatar

Level 5

I get what you are saying, but the issue is that if I do that, then the data is on the "component" level. I want to put all this data in one place, like lets say in a dam with a content fragment. I don't want to create a "dummy" page with all the data and just reference it in the component. I should be able to add a content with an "array/arraylist" type of content. Maybe I will try to create a new component datatype

Avatar

Level 10

IN AEM development - data rendered in a component is typically on the component level - that is stored as props on the component.  

Avatar

Level 4

You would be able puy the whole text  "2:20 - Atlanta" in a single line Text and then convert it into multified.

Content fragment models

1664190_pastedImage_0.png

Content Fragmet created.

1664191_pastedImage_2.png

Avatar

Level 4

Scott, if the requirement is to have a generic content to be used by Different channels (I believe thats the whole point of Content fragment), then we should have provision to enter any kind of data.  In the above example of movie

"Deadpool 2"

2:20 - Atlanta

3:00 - New York

Say, what if the requirement is to Highlight the time part in a different color and City in a different color.

If there was a way to group the time and city and then have option to capture multiples of them, it would have been great.

Do you mean to say Content fragment shouldn't be used in this case??

Regards,

Anand MN

Avatar

Level 5

Anand,

I agree. I believe content fragments should just be a "dialog" box of data in the jcr (kind of is). Are you saying putting a delimiter in a text field and parse it when I pull it from the jcr? I think that will be a good solution, but I don't think it is an ultimate solution. I think the ultimate goal is to be able to have all kinds of content fragment types....Like above. I looked into creating a new type of field (like multi-field) in content fragments, but have not had the time to finish it.

Sean