Support for taxonomy terms

Created on 21 November 2023, over 1 year ago

Problem/Motivation

Hi,

I need support to have the same functionality for taxonomy terms.

I would be grateful if you could add this functionality in subsequent versions of the module.

Thanks!

💬 Support request
Status

Active

Version

2.0

Component

Code

Created by

🇪🇸Spain daniel.delaiglesia

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

Merge Requests

Comments & Activities

  • Issue created by @daniel.delaiglesia
  • 🇪🇸Spain daniel.delaiglesia

    I have created a patch for it.

  • Status changed to Postponed: needs info 2 months ago
  • 🇮🇳India gaurav.kapoor

    @daniel.delaiglesia Do we need this change? Isn't default behaviour on viewing a unpublished term is 404 page not found?

  • Status changed to Active 11 days ago
  • 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

    We are testing it, and on Drupal 10.4 we are getting 403 and on Drupal 11 it returns the default language.

  • 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

    We also avoid fallback language when the translation does not exists.

    
        // Check if content is on the current language.
        // Access only published content.
        if (($entity->isTranslatable()
            && (!$entity->hasTranslation($current_language) ||
              !($entity->language()->getId() === $current_language))
          ) ||
          (!$this->currentUser->hasPermission('view any unpublished content') && !$entity->isPublished())
        ) {
          $cacheability = CacheableMetadata::createFromObject($entity)->addCacheContexts(['route', 'user.permissions']);
          $reason = 'Content not found or not accessible.';
          throw new CacheableNotFoundHttpException($cacheability, $reason);
        }
    
  • Pipeline finished with Success
    11 days ago
    Total: 199s
    #458623
  • Pipeline finished with Success
    11 days ago
    Total: 139s
    #458633
  • 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

    Added .gitlabci

  • 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

    The access denied comes from:

    \Symfony\Component\HttpKernel\EventListener\RouterListener
     

    \Symfony\Component\HttpKernel\EventListener\RouterListener::getSubscribedEvents

    public static function getSubscribedEvents(): array
    {
        return [
            KernelEvents::REQUEST => [['onKernelRequest', 32]],
            KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]],
            KernelEvents::EXCEPTION => ['onKernelException', -64],
        ];
    } 

    \Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest

    // matching a request is more powerful than matching a URL path + context, so try that first
    if ($this->matcher instanceof RequestMatcherInterface) {
        $parameters = $this->matcher->matchRequest($request); 

    \Drupal\Core\Routing\AccessAwareRouter::matchRequest

    public function matchRequest(Request $request): array {
      $parameters = $this->router->matchRequest($request);
      $request->attributes->add($parameters);
      $this->checkAccess($request); 

    \Drupal\Core\Routing\AccessAwareRouter::checkAccess

    if (!$access_result->isAllowed()) {
      if ($access_result instanceof CacheableDependencyInterface && $request->isMethodCacheable()) {
        throw new CacheableAccessDeniedHttpException($access_result, $access_result instanceof AccessResultReasonInterface ? $access_result->getReason() : '');
      }

    So we subscribe before it to give the 404.

    
      /**
       * {@inheritdoc}
       */
      public static function getSubscribedEvents() {
        return [
          // Launch method before RouterListener.
          // @see \Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest().
          KernelEvents::REQUEST => ['onKernelRequest', 33],
        ];
      }
    
Production build 0.71.5 2024