Image Caption Field display on Drupal 9

88 views Asked by At

I am using the Image Field Caption module to add captions to images in a paragraph type. I have enabled the caption field by going to Structure > Media Types > Images > Manage Fields and checking the box for captions (not required).

On the view mode, I do not find an option to display a caption when managing display.

I have tried editing the image-caption-formatter.html.twig file into my theme directly and also adding an argument into the paragraph template but I must be getting the something wrong.

{%
  set classes = [
    'paragraph',
    'paragraph--' ~ paragraph.id(),
    'paragraph--type--' ~ paragraph.bundle|clean_class,
    view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
    not paragraph.isPublished() ? 'paragraph--unpublished'
  ]
%}
{% block paragraph %}
  <div{{ attributes.addClass(classes) }}>
    <div class="container">
      {% block content %}
        {{ content.field_media }}
        {{ content.field_caption }}
        <div class="hero-content">
          {{ content|without('field_media') }}
        </div>
      {% endblock %}
    </div>
  </div>
{% endblock paragraph %}
{% if caption %}
  <blockquote class="image-field-caption">{{ caption }}</blockquote>
{% endif %}
0

There are 0 answers