Call to undefined method url() in DomainPathRedirectForm

Created on 24 February 2021, over 3 years ago
Updated 25 May 2023, over 1 year ago

Problem/Motivation

Error: Uncaught exception 'Error' with message 'Call to undefined method Drupal\domain_path_redirect\Entity\DomainPathRedirect::url()' in /mnt/www/html/aescorp/docroot/modules/contrib/domain_path_redirect/src/Form/DomainPathRedirectForm.php:179

Steps to reproduce

Save a redirect that already has another redirect with the same path, and this code is triggered:

      $redirect = array_shift($redirects);
      if ($this->entity->isNew() || $redirect->id() != $this->entity->id()) {
        $form_state->setErrorByName('redirect_source', $this->t('The source path %source is already being redirected. Do you want to <a href="@edit-page">edit the existing redirect</a>?',
          [
            '%source' => $source['path'],
            '@edit-page' => $redirect->url('edit-form'),
          ]
        ));

Proposed resolution

I think this should be $redirect->toUrl('edit-form')->toString() instead...

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jhedstrom Portland, OR

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.

Production build 0.71.5 2024