Multifield in content fragment model | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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.

25 replies

shehjadk2932098
April 3, 2018

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

Sean-McK
June 4, 2018

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.

smacdonald2008
June 4, 2018

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.,

Sean-McK
June 4, 2018

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?

smacdonald2008
June 4, 2018

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.

Sean-McK
June 4, 2018

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

smacdonald2008
June 4, 2018

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

January 10, 2019

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

Content Fragmet created.

January 10, 2019

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

Sean-McK
January 10, 2019

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