6

I have following problem:

There is a Download List Component on my site containing a heading and a list of Multimedia Links (That are mostly PDF files).

You can see an example here:

enter image description here

Inside the entity model class, the download items are MediaItem's which is fine so far. The problem is, that MediaItem only offers a method to get the file name from a Multimedia Component.

What I want is actually the Multimedia Component's name as seen in this screenshot:

enter image description here

I have tried to add my own class that extends MediaItem and then add a method to get the Components name but it was without success.

Is there actually a way to access a Component / Multimedia Component's name?

I am using Web 8.5 and DXA 1.7 Java.

Thanks!

2

In the DD4T model (json) the Title of a Component is available, but in the DXA abstraction it seems we considered this was part of the "domain model" and thus not propagated as we deemed it wasn't needed.

To solve it for DXA 1.7 it seems you have two options:

  1. Add the property to your model and create a Custom Model Builder (as part of the Model Builder Pipeline) to map this.

  2. Reuse one of the available metadata fields which are automatically mapped, by adding an Event Handler to your CMS which on save of the Component, copies the title to the metadata field of your choice.

I would say solution #1 is the more proper one, but option #2 is probably an easier one to implement.

Looking at your request I think it makes sence that we add this property to the DXA data model, so I suggest you create an issue on the GitHub repository for this, so we can treat it as an enhancement for the future.

  • 1
    Thank you Bart for this information. I was thinking about solution 2 too but it requires all existing components to be opened and saved again. I think we will try solution 1 then. I have also opened an issue on the DXA GitHub repository. Thanks! github.com/sdl/dxa-web-application-java/issues/73 – S. Gabriel Jun 29 '17 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.