No term UUID available

Created on 15 July 2023, 12 months ago
Updated 19 July 2023, 12 months ago

According to the module's help page, I should be able to access a term's UUID by [taxonomy_term:uuid]. However, this is not possible.

I try to set up a pathauto pattern, but when I save the pattern, I get the following error: Path pattern is using the following invalid tokens: [taxonomy_term:uuid].

I also tried [term:uuid] according to #3250374: Term UUID token is not working β†’ , which isn't working either - the same error is given. It seems like term UUID functionality has been removed. Or am I simply missing something?

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland maenjuel

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

Comments & Activities

  • Issue created by @maenjuel
  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    Here's a test. Open tokenuuid.module in a text editor and add the following after the 'use' statements at the beginning:

    function testitout() {
      $term = \Drupal\taxonomy\Entity\Term::load(1);
      $service = \Drupal::token();
    
      $text = 'the UUID is [taxonomy_term:uuid]';
    
      $token_data = [
        'taxonomy_term' => $term,
      ];
    
      $text = $service->replace($text, $token_data);
    
      return $text;
    }
    

    Then, find the return $output; line in the tokenuuid_help function and add this before that line:

    $output .= testitout();

    Then, load admin/help/tokenuuid

    Do you see the UUID?

  • πŸ‡¨πŸ‡­Switzerland maenjuel

    Thank you for your input @tolstoydotcom. Yes, I can see the UUID using your code.

    The problem seems specifically to be with term UUIDs only, I can use node UUIDs with pathauto, for example.

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    The issue fork has a proposed fix. The problem is that what Drupal core calls 'taxonomy_term', pathauto calls 'term'. I added an alter hook to deal with such cases.

    Clear caches after downloading the fork. You can also just click it and replace tokenuuid.module from the fork with the file in your installation.

  • πŸ‡¨πŸ‡­Switzerland jerome legendre Lausanne

    Hello,

    I don't use Drupal anymore since a lot of time, i need somebody to take ownership to this project.

    Please contact me if you are interested.

  • πŸ‡¨πŸ‡­Switzerland maenjuel

    Awesome, with the file from the issue fork it works indeed. Thank you so much for looking into it!

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    jerome legendre: famous last words, but feel free to add me as a co-maintainer or make me the maintainer,

  • πŸ‡¨πŸ‡­Switzerland jerome legendre Lausanne

    Done, you are the new maintainer.
    You could now remove me from the maintainers group.
    Thank you

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    2.0.4 is now available for installation, it has the merge request code.

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.
  • Status changed to Fixed 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024