0

I am trying to get the machine name of the responsive image style attached to a field. I am not able to get this from the settings attached; it seems it is not accessible from the object in any way.

How can I get the responsive image style ID from a FileFieldItemList?

  • I am not sure what you are asking. What are you trying to accomplish? – Frank Robert Anderson Jun 21 '16 at 16:08
  • The image style won't be accessible on the field type, but it is probably accessible for a field formatter. Can you provide more details or code around where you are trying to get the machine name and for what purpose? Are you trying to format an image field? – mradcliffe Jun 21 '16 at 17:09
0

This setting is not a field setting. Because a field can be part of different displays. You have to look for this setting in a view mode. For example if you configure the image field of the article with a responsive image style, your view mode would contain something like this:

core.entity_view_display.node.article.default:
  content:
    field_image:
      type: responsive_image
      weight: 0
      settings:
        responsive_image_style: *responsive_image_style_id*

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.