All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Please read about the changes to BoldMinded add-on licensing.

Ticket: Can’t access file attributes such as description, height, width, in simple grid file field

Status Resolved
Add-on / Version Simple Grids & Tables 1.7.4
Severity
EE Version 7.4.11

Blake DuBose

Jun 21, 2024

Description of the problem

I’m trying to access the description of a file field that is located within a simple grid, with a bloq.

Template Code:


<!-- BLOQ -->
{carousel_block}
    <!-- SIMPLE GRID -->
    {carousel_images}
       <!-- Everything works except the tag pair contained within the alt embed variable below -->
        {embed="embeds/_picture"
            src="{carousel_image:resize width="800" quality='82'}"
            webp="{carousel_image:webp width="800" quality='85'}"
            class="w-full h-full object-center {if carousel_image_original == 1}object-contain{if:else}object-cover{/if}"
            alt="{carousel_image}{description}{/carousel_image}"
        }
    {/carousel_images}
{/carousel_block}

Rendered Code:


<picture>
    <source srcset="https://example.ddev.site/uploads/page-images/_webp/SCRM_webp_04ed92fcc3ffce84e58cd6b69aa5065b.webp" type="image/webp">
    <img 
        src="https://example.ddev.site/uploads/page-images/_resize/SCRM_resize_993bf2ca9dd3c6c81a52aa14ead99aac.jpg" class="w-full h-full object-center object-cover"  
        alt="{carousel_image}{description}{/carousel_image}"
    >
</picture>

To Reproduce**

Steps to reproduce the behavior: 1. Create bloq field with a simple grid field containing a file field

Environment Details:

  • Version: [Latest]
  • PHP Version [8.1]
  • MySQL Version [maria-db 10.6]
  • OS: [e.g. Linux/macOS]
  • Web Server: [nginx/DDEV]
#1

BoldMinded (Brian)

Did you try prefixing the file field tag?

{carousel_images:carousel_image} {description} {/carousel_images:carousel_image}
#2

Blake DuBose

Okay, that does work. There is another issue that I’m seeing now in the CP when I try to edit the file attributes via the pop out menu. Attaching an image.

#3

Blake DuBose

https://boldminded.com/assets/support/uploads/Screenshot_2024-06-21_at_6.47.32%E2%80%AFPM_.png

#4

BoldMinded (Brian)

This is an issue with the fields-upload-chosen-name div’s data-id attribute not being the ID of the file. Bloqs and SG does not actually create this HTML, it comes from EE itself. I don’t know why this is happening. Would be interested to see if it happens in a native Grid field too.

<div class="fields-upload-chosen-name" data-id="col_id_4">
  <div title="latest">
       latest     </div>
  <!--<div class="list-item__secondary">File Size</div>-->
 </div>
#5

BoldMinded (Brian)

I think I have a fix, I’ll send a new build on Monday.

#6

BoldMinded (Brian)

Comment has been marked private.

#7

Blake DuBose

Seems to be working now.

Login to reply