Image content type

Enonic version: 6.6.1
OS: Ubuntu 16.XX

Can you modify the attributes for image content type ?

In my case I want to make the Caption field to be a HTMLArea ( to support formatting ) and not TextArea.

I don’t think so. It would make things more breakable if Enonic allowed us to override the built in types like that.

You could create a new content type ImageWithFancyCaption (or SuperImage, your call) that would have an image and a HtmlArea.

Perhaps you even could make your new content type use the media:image as its super-type, and thereby just extending it?

Hum, I see.

The problem is that we have dozens of images using media:image content type already. It would take quite some time to replace those if we would create our own image content type.

But I get you point. :+1:

I see what I can do.

Does extending them work now? I tried that in 6.0.0 and it didn’t work then. I think “structured” is really the only supertype you can “extend”. See my thread on this here: How do I extend a content type in XP 6.0?

Or is this a way to get the image handler to work for the new content type?

The media types are currently not directly customizable, as they are shipped by default. As you can see from the supertype design, we have some plans here. Basically building your own custom media-types, or even potentially “overriding” the default ones.

To solve your issue however you might add an x-data extension to your site - all images (and other items) stored within that site will get the additional fields (like this:

The only problem with x-data in site.xml is that the x-data will be available to ALL content types. There should be a way to limit x-data to only the types that you want. That way we could basically modify a single built-in type.

For example, if you want to add an InstagramURL field to the built-in image content then the only way to add it is with x-data in the site.xml. Now every content you make will have an x-data field for InstagramURL when it makes no sense for anything other than images to have that field. It’s the same thing with the “menu item” checkbox. If you want to add it to any built-in type then the only option is to add it to all types. Could we add an <allowTypes> to x-data in site.xml?

1 Like

It might be possbile - create a feature requiest here on the forum and we’ll process it.