Current image settings only allow for settings per Node type. The idea is to extend these settings to common entity types such as Paragraph, Custom Blocks and Comments.

Additionally I would like to experiment with an alignment override per Image Style. I'm not sure how this will work out and I'll need to build an MVP (min viable product) and play around with it. For example where an entity type has an alignment setting AND the image style used for one of the view modes in the entity display has a setting, then which one should win?

E.g.

Node article teaser image field uses: image style "Medium"
Node article teaser image alignement: left
Image style Medium alignment setting: right

So which one should win - the node teaser setting, or the image style Medium setting?

Original Issues:

I have an image field inside a Paragraph Type created under the paragraph module. Is there a way to modify the code of the theme to extend that to image fields inside that paragraph type? While we're on the subject, might be equally interesting to figure out how to extend this feature to a field collection, block, etc.

Although there are some contrib modules that provide this feature, they are not D8 ready, and since this theme already has a caption feature, might be easier to extend it.

I'm going to look at the code, but just thought I'd pose the question here. Ideas welcome.

Comments

RKopacz created an issue. See original summary.

Jeff Burnz’s picture

Category: Support request » Feature request

I suppose it's plausible, I've never really looked at field rendering in paragraphs (I use the module but never looked too hard at it), I'll have to investigate whats going on, as to why it doesn't just work anyway.

Jeff Burnz’s picture

We could add Paragraph entities to the image settings, or I am wondering if we change how these settings work to use the Image Style instead, I didn't even realise I could do this until today and the "node entity" centric settings merely replicate what was done in D7.

I think that could really work well, instead of setting image position for the whole node, we set it per Image Style.

Jeff Burnz’s picture

Title: extend caption feature to image field inside paragraph type from Paragraph module » Extend Image Settings to common Entity types and per image style
Category: Feature request » Plan
Issue summary: View changes
Jeff Burnz’s picture

Initially I say we do the entity types - Paragraphs, Comment and Custom Blocks since this is really low hanging fruit (I say fingers crossed, ha ha ha...).

RKopacz’s picture

Jeff, sorry to be away from this thread for so long. I realize that opening this up to all entities can create a Pandora's Box in terms of theme overhead, or maybe not? I ended up solving this by custom templating the paragraphs to output the title attribute directly in the template, which is a snap with twig. Perhaps an interim setting that allows you to choose which entities you would like the the image settings for? I'm not sure if that would complicate things or make them easier.

RKopacz’s picture

As far as the Image Styles, I always found the ability to set the position of the image on the node very handy: Left, right center etc, but its easy enough to set the image styles in the content type config pages. Your call on that.

Jeff Burnz’s picture

Category: Plan » Task

Yeah, doing all entity types is far too many, there are many in Drupal, probably things you are not even aware of are entities, e.g. theres about 30+ entity types. Even an interim setting would be overwhelming and confuse most users.

The best idea I think is to target entities that support Display Modes, e.g. Node, Comment, Custom block, Taxonomy, User and Paragraph entity types.

Taxonomy and User work a little different to the others so I'm avoiding those for now, but I have the others working and its all backwards compatible with your original Node type settings.

I built the MVP and it's working, bit of testing today and I'm gonna commit it.

  • Jeff Burnz committed 78c55fa on 8.x-1.x
    Issue #2821538: Extend Image Settings to common Entity types and per...

  • Jeff Burnz committed 78c55fa on 8.x-2.x
    Issue #2821538: Extend Image Settings to common Entity types and per...
Jeff Burnz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.