My site is running Drupal 8.9 and I’m preparing the upgrade to Drupal 9.
After updating Geolocation module from 8.x-1.11 to 8.x-3.7 I’m receiving the error:
Fatal error: Trait ‘Drupalcustom_modulePluginBlockDrupalgeolocationGoogleMapsDisplayTrait’ not found in /custom_module/src/Plugin/Block/LocationsMapBlock.php on line 21
It my custom module I use GoogleMapsDisplayTrait trait, but it seems it’s not used now and replaced with abstract class GoogleMapsProviderBase located at modulesgeolocation_google_mapssrcGoogleMapsProviderBase.php
Before that I was using a trait like this:
<?php namespace DrupalmymodulePluginBlock; use DrupalCoreBlockBlockBase; use DrupalCoreAccessAccessResult; use Drupalgeolocation_google_mapsGoogleMapsProviderBase; use DrupalnodeEntityNode; use DrupalmymoduleRetrievesEvents; use DrupalCoreSessionAccountInterface; /** * @Block */ class LocationsMapBlock extends BlockBase { use GoogleMapsDisplayTrait; /** * {@inheritdoc} */ public function build() { return [ '#theme' => 'locations_map', '#attached' => [ 'library' => ['mymodule/map'], 'drupalSettings' => [ 'geolocation' => [ 'google_map_url' => $this->getGoogleMapsApiUrl(), ], 'locations' => $this->getLocationMapData(), ], ], ]; }
now the same code to access google maps is in "abstract class GoogleMapsProviderBase extends MapProviderBase", not a trait.
How to access the methods of this abstract class in my custom module?