Problem/Motivation

Drupal 11.3.3
Alt-Text Validation 1.0.1

After a fresh installation of the module, it's not possible to visit the Rules list - admin/config/content/alt-text-validation/rules, it throws the white screen error:

The website encountered an unexpected error. Try again later.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.alt_text_rule.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 214 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute() (Line: 290)
Drupal\Core\Routing\UrlGenerator->generateFromRoute() (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute() (Line: 773)
Drupal\Core\Url->toString() (Line: 176)
Drupal\Core\Utility\LinkGenerator->generate() (Line: 104)
Drupal\Core\Render\Element\Link::preRenderLink()
call_user_func_array() (Line: 107)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)
Drupal\Core\Render\Renderer->doCallback() (Line: 441)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 82)
__TwigTemplate_02324dfcc297b96017c1f1cd0c11f4a9->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 386)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 35)
Drupal\Core\Template\TwigThemeEngine->renderTemplate() (Line: 428)
Drupal\Core\Theme\ThemeManager->render() (Line: 500)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 184)
__TwigTemplate_fa7fa3a9dba9a462e8cb6e46d50a0c9d->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 386)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 35)
Drupal\Core\Template\TwigThemeEngine->renderTemplate() (Line: 428)
Drupal\Core\Theme\ThemeManager->render() (Line: 500)
Drupal\Core\Render\Renderer->doRender() (Line: 513)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 634)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 60)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)

However, I was able to create a new rule using this URL:/admin/config/content/alt-text-validation/rules/add, and it works when adding a new image. However, the list of rules is still not possible to visit.

Besides this error, the report generation is also broken, it throws another error, probably it should be a seperate issue.
Error: Call to a member function createFileUrl() on null in Drupal\alt_text_validation\Service\ValidationTools->validateImageField() (line 131 of /var/www/html/web/modules/contrib/alt_text_validation/src/Service/ValidationTools.php).

Steps to reproduce

  • Install the module
  • Go to admin/config/content/alt-text-validation/rules,
CommentFileSizeAuthor
#10 3580242-alt_text_validation.patch2.57 KBdkmishra
#2 error.png205.41 KBravi kant
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

tarazingo created an issue. See original summary.

ravi kant’s picture

StatusFileSize
new205.41 KB

I am facing the same issue.

I am using Drupal 11 and installed the module with Composer. Then I navigated to the configuration page and clicked on the Rules tab.

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

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

hoxton’s picture

upon navigating to rules for collective view. This commit's changes were able to resolve previously stated error

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

dkmishra’s picture

In the commit, removing "canonical" = "/admin/config/content/alt-text-validation/alt-text-rule/{alt_text_rule}" may break code that depends on the "canonical" route, such as:

'apex_entity_url' => ($apex_entity->isNew())
  ? ''
  : $apex_entity->toUrl('canonical', ['absolute' => TRUE])->toString(), // line 135 in ValidationTools.php

dkmishra’s picture

Version: 1.0.1 » 1.0.x-dev
Status: Active » Needs review
StatusFileSize
new2.57 KB

Here is the patch, please review.