Problem with swiper formatter for a image field

Created on 27 August 2022, over 2 years ago
Updated 9 June 2023, over 1 year ago

Problem/Motivation

In manage display of a content type I set the swiper image formatter for an image field but, after that, the blue circle still spinning without applying the desired configuration to the field. I am using Drupal 9.3.9

Steps to reproduce

Create a content type with an image field where you can add more images
Go to the manage display and set the swiper image format to the image field

💬 Support request
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇹Italy coolest

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇷🇺Russia alexd73

    I have the some trouble. I found this error in the logs.
    TypeError: Illegal offset type in isset or empty in Drupal\swiper_formatter\Plugin\Field\FieldFormatter\SwiperFormatterImage->settingsSummary() (line 213 of /var/www/html/web/modules/contrib/swiper_formatter/src/SwiperFormatterTrait.php).

    Drupal 10
    drupal/swiper_formatter:1.0.x-dev@dev

    Please review my report as well.

  • 🇷🇺Russia alexd73

    UPD for #13

    I've commented the bellow part of the code and successfully enabled the Swiper image formatter, then uncommented this back and the error has disappeared. I can change the field formattter w\o error now.

        if ($caption = $this->getSetting('caption')) {
          switch ($caption) {
            case 'title':
            case 'alt':
              $summary[] = $this->t('Caption: Image @caption field', ['@caption' => ucfirst($caption)]);
              break;
    
            default:
              $fields = $this->entityFieldManager->getFieldDefinitions($this->fieldDefinition->getTargetEntityTypeId(), $this->fieldDefinition->getTargetBundle());
              if (isset($fields[$caption])) {
                $summary[] = $this->t('Caption: @caption field', ['@caption' => $fields[$caption]->getLabel()]);
              }
              break;
          }
        }
    
Production build 0.71.5 2024