Remove getImplementations

Created on 27 November 2023, about 1 year ago
Updated 22 February 2024, 10 months ago

There is a deleted method getImplementations that return and error with drupal 10:

The website encountered an unexpected error. Please try again later.

Error: Call to undefined method Drupal\Core\Extension\ModuleHandler::getImplementations() in bat_entity_access() (line 136 of modules/contrib/bat/bat.module).
call_user_func_array(Object, Array) (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'bat') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_access', Object) (Line: 416)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_access', Array) (Line: 96)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', Object, ) (Line: 706)
Drupal\Core\Entity\ContentEntityBase->access('view label') (Line: 383)
Drupal\Core\Entity\Element\EntityAutocomplete::getEntityLabels(Array) (Line: 119)
Drupal\Core\Entity\Element\EntityAutocomplete::valueCallback(Array, , Object)
call_user_func_array(Array, Array) (Line: 1287)
Drupal\Core\Form\FormBuilder->handleInputElement('bat_event_availability_hourly_edit_form', Array, Object) (Line: 1005)
Drupal\Core\Form\FormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 144)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('bat_event_availability_hourly_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 43)
Drupal\bat_api\StackMiddleware\BatApiMiddleware->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 45)
Drupal\services\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I don't know what is the policy for major versions, but this code is only supported since 9.4, although I haven't put this dependency for the moment.

I'm also not clear what the code does, I just changed the if the getImplementations for the hasImplementatiosn and the code that saved the logs a warning of the deprecated code, but that can no longer be used in Drupal 10.

🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇪🇸Spain Carlitus

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

Comments & Activities

Production build 0.71.5 2024