3D Carousel images disappear when authenticated and not owner

Created on 31 May 2023, over 1 year ago
Updated 27 June 2024, 6 months ago

Problem/Motivation

I have discovered a strange behaviour with the 3D Carousel. The images in the Carousel are visible when you are not logged in to the website. When a non-Administrator account logs in, the images in the Carousel are no longer visible.

I am using the Content Access module, and thought that incorrect permissionsmay be causing the issue, but this doesn't appear to be the case. I can create a new 3D Carousel, add some images to it, and the issue remains.

Steps to reproduce

Drupal 10
Amun W3CSS Theme

Create a 3D Carousel, add 3 or 4 images to it. Save.
View the Carousel as an unauthenticated user - the images are visible.
Login as a different user (non-administrator) from the one that created the Carousel and view the Carousel - the images are not visible.

πŸ’¬ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡¦Saudi Arabia ishore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ishore
  • Assigned to flashwebcenter
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,
    On the demo site I followed the steps. I logged in as an editor and created a new 3D carousel, but I was able to see the carousel.
    What you have, it could be permissions issue or some conflict with Javascript. I would recommend debug the site, check permissions, create 3D carousel with simple text.

    Best wishes,
    Alaa

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore

    I can re-create the same problem on two different environments - one running Drupal 9 and one running Drupal 10. I will investigate further.

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore

    Did a diff of the Source of the unauthenticated (visible) and the authenticated (not visible), and there was some differences in the HTML that deals with the image display:

    Unauthenticated (Visible):

    Image

    Authenticated (Not Visible):

    div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item">

    Image

    I changed the names of the image file names in the HTML output here, but other than that, this is the actual HTML. I see the same differences for each image in the Carousel. Might this explain why there is a difference in the two displays?

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,
    I don't see in the bod-snippet.txt "w3-img-wrapper". Not sure if the custom template is uploaded. You will need to enable twig debug and check the which template is used.

    Best wishes,
    Alaa

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore

    Hi Alaa

    Please ignore the previous data provided. I've been able to spend more time looking at the differences between the "good" (displays image and image title in Carousel) and "bad" (display only image title in Carousel"), and, for the carousel section of the page HTML, I performed a diff and find only a small difference in the div lines.

    For the purposes of diplaying the HTML correctly here, I will replace < and > with { and }:

    Good:

    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"{{div}
    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div}
    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div}
    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div}

    Bad:

    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div class="contextual-region"}
    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div class="contextual-region"}
    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div class="contextual-region"}
    {div class="w3-row field field--name-w3css-content-image field--type-entity-reference field--label-hidden w3-bar-item field__item"}{div class="contextual-region"}

    Would you still recommend checking the twig template?

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore

    After enabling Twig debug, I see the following in the "bad" display:

    {!-- BEGIN OUTPUT from 'core/modules/media/templates/media.html.twig' --}
    {div class="contextual-region"}
    {div data-contextual-id="media:media=7:changed=1657692050&ds_bundle=w3css_media_image&ds_view_mode=w3css_media_view_image&langcode=en" data-contextual-token="sVhirvZqyDeR27EfgUAHwsh3TGrKiRYJwyDIp4K3JBY"}{/div}

    {!-- THEME DEBUG --}

    and this in the "good":

    {!-- BEGIN OUTPUT from 'core/modules/media/templates/media.html.twig' --}
    {div}

    {!-- THEME DEBUG --}

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore

    After further investigation, it seems that the images are not visible only to users with the role "Content Editor". I can remove the role from the user, refresh the page, and the images in the Carousel become visible.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,
    You can try different methods for debugging like:

    • Login as a content editor and create a carousel.
    • Create a new role in the system and use it to create a new carousel.
    • Create a new paragraph bundle with image and use it when you logged in as a content editor.
    • Login as a content editor and an admin in two browsers and start to disable modules one by one. You cans start with the 3D carousel.

    If the output for for the field does not have any html, mostly it is permissions.
    Best wishes,
    Alaa

  • πŸ‡ΈπŸ‡¦Saudi Arabia ishore

    Firstly, my testing has so far only found an issue with the 3D Carousel. W3CSS Cards and Images don't exhibit the same issue.

    The problem does seem to be related to the combination of W3CSS 3D Carousel in combination with the Media Directories module. When I try to add a W3CSS image to the carousel from a Media Directories sub-directory, the image doesn't display. But when I add the same image but from the root directory, it displays correctly.

    Anyway, at least I now have a fix, even if the cause of the problem is not clear.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,
    I am closing since you have a fix.
    Best wishes,
    Alaa

  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX
Production build 0.71.5 2024