The image class field shows up now for the image field under Manage display, but after clicking "Update" and then "Save", the classes are not added to the "img" tag. I have a number of the Field formatter settings dependent modules enabled and in use, plus I have others like "semantic fields". I'm listing below and just wondering if there might be a known conflict with any of them and Image class module. Also, the specific page where I'm trying to use the class is at "https://monsterweb.net/about/team/darryl-fresne". The classes I need to add to the "field-name-field-user-picture" are "img-circle img-polaroid".

Enabled modules relating possibly to classes:

  • Image class: 7.x-1.0
  • Semantic Fields: 7.x-1.1-beta1
  • Text formatter: 7.x-1.3
  • Field injector: 7.x-1.0-beta3
  • Linked Field: 7.x-1.8
  • Field Formatter Class: 7.x-1.1

Any ideas? Thanks.

Comments

yannickoo’s picture

Could you try to disable them piece for piece so you can reproduce which other module breaks the functionality?

Anonymous’s picture

I don't usually disable modules on a live site, unless after enabling it stops something from working that worked before. If I disable those other modules it won't lose my configuration where it's used, right? Such as semantic fields (used a lot) is set to be the field formatter/wrapper in a lot of areas and it would be a HUGE pain if I disabled it and lost the functionality.

Also, I noticed the Image class works for views output, but as I already mentioned, not in the normal node Manage display settings.

yannickoo’s picture

Clone that website and install it locally :)

yannickoo’s picture

Status: Active » Postponed (maintainer needs more info)
yannickoo’s picture

Could you figure it out?

P.Smith’s picture

I'm experiencing the same problem. No other field formatter modules are enabled, so I'm not sure where to start. I'm using Views, CTools, Pathauto, Entity Reference and a few other modules. No third party modules with regards to images. Views is not used on this page either. I think it would be simpler to build from scratch rather than clone it and gradually disable modules to establish which one is causing a conflict (as so many are dependent on another or fields with content already in). Unless someone has a simpler suggestion for debugging it?

sydkoh’s picture

Issue summary: View changes

This is a conflict with field formatter class. When you Disable - Img class works fine, when that module is enabled - Img class does not work.

marc.groth’s picture

Perhaps I'm missing something but in image_class_field_attach_view_alter() there is a check for the class and if it's not found then the code is exited. Is this correct? What happens if the first field has no class but the second does? With this code it will never execute. I think instead of a return this should be a continue.

So instead of:

if (!isset($settings['class'])) {
  return;
}

I think it should be:

if (!isset($settings['class'])) {
  continue;
}

Alternatively you could just slightly alter the if statement to look for something true and then put the rest of the code in there like so:

if (isset($settings['class'])) {
  // Rest of the code goes here instead.
}

This way the loop can continue even if/when it can't find a class for a particular field. Happy to provide a patch if required; I just wanted to check I wasn't overlooking something?

yannickoo’s picture

Oh Marc, I think you are still using an older version of Image Class, this was already fixed in a4baf33f3.

Please install the latest development version of Image Class, maybe this can fix your site :)

yannickoo’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Feel free to reopen this issue when you have still problems with this :)