This is a follow up issue to #2645458: data-align and data-caption don't work with entity_embed.

It seems data-align doesn't work without a caption. If you want to have your embed to the right of a paragraph, but no caption, this is currently broken.

Comments

oknate created an issue. See original summary.

oknate’s picture

Title: data-align only works if you have a caption » data-align should work without caption
oknate’s picture

oknate’s picture

Status: Active » Closed (duplicate)
oknate’s picture

Status: Closed (duplicate) » Needs work

reopening. Although I think I have a fix for both issues in 3037316, comment 18

oknate’s picture

I'm now having trouble recreating the bug. Although I definitely saw it earlier today.

oknate’s picture

Status: Needs work » Closed (cannot reproduce)

I'll reopen this if I see it again and have steps to reproduce. Right now I can't get it to happen.

generalredneck’s picture

I'm totally having this issue but I haven't went through the process of debugging to see where the breakdown is coming into play. THere are also a lot of variables in my case including, varbase_media, blazy, and the like.

oknate’s picture

If you can create steps to reproduce, please do. Perhaps we'll reopen it.

eahonet’s picture

@oknate I'm running into this on D9 with Bartik theme. If I add a caption to an image, the alignment is honored with <figure role="group" class="caption caption-drupal-media align-center">. Without that, no is outputted and no alignment given in html.

I'm wondering if you found a solution to this.

tlwatson’s picture

To anyone still coming across this... I was able to fix the problem by reordering my "filter processing order".

Specifically, if you have "Limit allowed HTML tags and correct faulty HTML" enabled, then it must come before "Align images" and "Caption images". Looking at the filter details, I think the problem is that the IMG element allows all the needed "data-" attributes for align/caption, but does not allow the "class" attribute. So you don't want to convert the data- attributes to classes and then get them stripped out.

If for some reason you have to bypass this instead of reordering you could probably add <img class> to your manually editable tags, but I doubt that's right for most scenarios. If you have any other data-* filters to process, they should probably go after the HTML filter too.