Views format broken with Leaflet 10.2.25

Created on 29 August 2024, 3 months ago

Problem/Motivation

I tried installing on a Drupal 10 site and couldn't get the settings for CiviCRM Entity Address Leaflet Map view format to load.

Console showed an ajax error.

Error: Call to a member function getViewModes() on null in Drupal\\civicrm_entity_leaflet\\Plugin\\views\\style\\CivicrmEntityAddressLeafletMap->buildOptionsForm() (line 288 of modules/contrib/civicrm_entity_leaflet-civicrm_entity_leaflet/src/Plugin/views/style/CivicrmEntityAddressLeafletMap.php

I downgraded to leaflet 10.2.14 and it's working as expected.

Thanks

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇦🇺Australia joewickert

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

Comments & Activities

  • Issue created by @joewickert
  • 🇬🇧United Kingdom tonyhrx

    The dependency for the entity display repository service is not being assigned to a class property. Here's a patch.

    --- a/CivicrmEntityAddressLeafletMap.php
    +++ b/CivicrmEntityAddressLeafletMap.php
    @@ -38,6 +38,13 @@ class CivicrmEntityAddressLeafletMap extends LeafletMap implements ContainerFactor
      */
     class CivicrmEntityAddressLeafletMap extends LeafletMap implements ContainerFactoryPluginInterface {
     
    +  /**
    +   * The entity display repository.
    +   *
    +   * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
    +   */
    +  protected $entityDisplay;
    +
       /**
        * {@inheritdoc}
        */
    @@ -56,7 +63,10 @@ class CivicrmEntityAddressLeafletMap extends LeafletMap implements ContainerFactor
           $container->get('link_generator'),
           $container->get('plugin.manager.field.field_type')
         );
    -    return new self(
    +    
    +    // Assign the entity display repository service to the class property
    +    $instance->entityDisplay = $container->get('entity_display.repository');
    +    
    +    return $instance;
       }
Production build 0.71.5 2024