Problem/Motivation

When trying to delete a destination the following error comes up "The website encountered an unexpected error. Please try again later"
On inspection of the logs the error details are below.

Error: Call to undefined method Drupal\login_destination\Entity\LoginDestination::getLabel() in Drupal\login_destination\Form\LoginDestinationDeleteRuleForm->getQuestion() (line 21 of /var/www/vhosts/example.com/modules/contrib/login_destination/src/Form/LoginDestinationDeleteRuleForm.php)
#0 /var/www/vhosts/example.com/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php(57): Drupal\login_destination\Form\LoginDestinationDeleteRuleForm->getQuestion()
#1 [internal function]: Drupal\Core\Entity\EntityConfirmFormBase->buildForm()
#2 /var/www/vhosts/example.com/core/lib/Drupal/Core/Form/FormBuilder.php(534): call_user_func_array()
#3 /var/www/vhosts/example.com/core/lib/Drupal/Core/Form/FormBuilder.php(281): Drupal\Core\Form\FormBuilder->retrieveForm()
#4 /var/www/vhosts/example.com/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#5 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#6 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#7 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#8 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#9 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#10 /var/www/vhosts/example.com/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 /var/www/vhosts/example.com/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#12 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#13 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#14 /var/www/vhosts/example.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#15 /var/www/vhosts/example.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#16 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#17 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#18 /var/www/vhosts/example.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#19 /var/www/vhosts/example.com/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#20 /var/www/vhosts/example.com/index.php(19): Drupal\Core\DrupalKernel->handle()
#21 {main}

Steps to reproduce

Create a new destination then try to delete it

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

trevorforrest created an issue. See original summary.

vinodhini.e’s picture

Am also facing this issue. Can anyone help with this?

Rishi Kulshreshtha made their first commit to this issue’s fork.

rishi.kulshreshtha’s picture

Version: 8.x-2.0-beta6 » 8.x-2.x-dev
Category: Support request » Bug report
Status: Active » Needs review

I have replaced the getLabel() method with the appropriate label() method, ensuring the correct invocation of the method for deleting the destination.

akram khan’s picture

StatusFileSize
new723 KB
new179.42 KB

I reviewed the MR and it's resolved the issue. Additionally, I have attached before and after state screenshots for reference

ammar qala’s picture

In case someone needs to apply #4 patch.

ammar qala’s picture

rishi.kulshreshtha’s picture

@Ammar Qala, thanks for your efforts but there's no need for a patch when someone can use https://git.drupalcode.org/project/login_destination/-/merge_requests/13...

keshavv’s picture

Status: Needs review » Reviewed & tested by the community

As method getLabel() is deprecated.
We can use the MR.
It works well, +1 for RTBC

hockey2112’s picture

The patch in #8 worked for me.

rsvelko made their first commit to this issue’s fork.

rsvelko’s picture

Status: Reviewed & tested by the community » Fixed

patch #8 and MR13 have same changes.
Just merged MR13.
All good now - just tested and after latest changes, we can delete rules again.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.