Logic for Synonym(ed) terms is not quite right when using the

Created on 14 February 2025, about 2 months ago

Problem/Motivation

The integration of Taxonomy Term Glossary with synonym terms is a great step forward in functionality.

However, we are slightly questioning the logic of linking synonym(ed) terms display when using the 'Match only once per field' option.

Scenario

Imagine a scenario where we have a page with the term: General Data Protection Regulation via a number of associated Synonyms:

  1. GDPR
  2. Privacy regulation
  3. Data protection law
  4. Data protection legislation
  5. EU Data Protection Regulation
  6. EU GDPR
  7. European Data Protection Law

As such, even with the 'Match only once per field' option active, it should really still link each and every one of those 'options to the pop-up because as far as THIS PAGE is concerned, they are indeed unique instances of its use.

Currently, such a page would appear…

We believe that it should appear like this…

πŸ› Bug report
Status

Active

Version

4.2

Component

Miscellaneous

Created by

πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

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

Comments & Activities

  • Issue created by @SirClickALot
  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset
  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset
  • πŸ‡«πŸ‡·France mably

    Actually I got the idea from here: https://www.drupal.org/project/glossify/issues/3269949 ✨ Add in a synonyms feature Needs work

    Here is what is said there:

    With my patch, both "President of the United States" and "POTUS" are candidates to be glossified. Since my sites require only the first found match be glossified, if one term is glossified then the other will not be, regardless of which one occurs first.

    But may be we can add a configuration option to behave differently.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    @mably,

    OK, I get that and I agree the it is actually sound idea too.

    However, in our case matching only the first is the polar opposite of what we need because we have a whole lot of terminology splattered around the place, all of which actually means the same thing and it's really confusing the novices.

    Thinking on my feet here possibly the most commonly encountered one is...

    You can do this quickly and easily in the console.
    You can do this quickly and easily in the shell.
    You can do this quickly and easily in the CLI.
    You can do this quickly and easily in the terminal.
    You can do this quickly and easily in the command prompt.
    You can do this quickly and easily in the REPL.
    You can do this quickly and easily in the TTY.

    If we set aside splitting hairs about true definitions, all of those sentences are 'saying' exactly the same thing so one can see quite why we want to link all of those synonyms to a unifying description that covers all bases.

    And that's just the start of it in the computing tutorial world!

    So in summary yes, we agree wholeheartedly that, if using a synonym mechanism (such as the Synonyms module), there should be an option to check a box to say Target all synonyms for 'glossification' or not, depending on your use case.

    Everybody's catered for, everybody's happy.

    PS,
    I like the POTUS example, it is especially in the zeitgeist.
    Perhaps POTUSageddon is fitting.

  • πŸ‡«πŸ‡·France mably

    New configuration option soon available:

  • πŸ‡«πŸ‡·France mably

    @sirclickalot the fix has been included in this issue's MR: ✨ POC: use ABBR HTML elements for glossary terms Active

    Feel free to give it a try.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    @mably - thanks for that.

    After patching with MR: #3506501 I am hitting a WSD with...

    [15-Feb-2025 05:31:11 UTC] Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\term_glossary\Service\TermGlossaryManager::__construct(), 7 passed in C:\Users\nick\Sites\bit-by-bit.org\public_html\core\lib\Drupal\Component\DependencyInjection\Container.php on line 261 and exactly 8 expected" at C:\Users\nick\Sites\bit-by-bit.org\public_html\modules\contrib\term_glossary\src\Service\TermGlossaryManager.php line 72

    I suspect this might be PHP version related as we are on 8.3.7 but rolling that back to 8.2 and even below seems to cause other ill effects for us with other modules so not an option.

    Rolling back to 4.2.0-alpha6 for now.

  • πŸ‡«πŸ‡·France mably

    Have you purged all the caches?

    The new plugin manager service has been added as a constructor parameter to the Term Glossary service.

    I just merged it to the dev branch so it will be easier to test.

  • πŸ‡«πŸ‡·France mably

    @sirclickalot if dev branch is ok for you, I'll make an alpha7 release.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    @mably,

    I updated to the DEV branch using composer but to avail - same issue as before - WSD and...

    [15-Feb-2025 09:40:18 UTC] Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\term_glossary\Service\TermGlossaryManager::__construct(), 7 passed in C:\Users\nick\Sites\bit-by-bit.org\public_html\core\lib\Drupal\Component\DependencyInjection\Container.php on line 261 and exactly 8 expected" at C:\Users\nick\Sites\bit-by-bit.org\public_html\modules\contrib\term_glossary\src\Service\TermGlossaryManager.php line 72
    

    On both occasions I have done multiple cache clears before reporting.

    I don't think this is PHP dependency/discovery relate is it, I think it might be a PHP 3.x+ issuse or do you suspect that my local site is still 'seeing' an older version of the service provided by TermGlossaryManager.php ?

    BTW, I am not uninstalling and re-installing the module, could it somehow be related to new configuration that is only taking effect on reinstall?

  • πŸ‡«πŸ‡·France mably

    Pretty strange...

    You could check the number of parameters you have in the TermGlossaryManager constructor here:

    https://git.drupalcode.org/project/term_glossary/-/blob/4.2.x/src/Servic...

    And the number of corresponding parameters declared in the services.yml file here:

    https://git.drupalcode.org/project/term_glossary/-/blob/4.2.x/src/Servic...

    Are you using with Docker?

    When using Docker I noticed that, sometimes, the latest file changes are not picked up.

    I just need to restart my Drupal container to have things running fine again.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    @mably,

    Everything present and correct in both Service PHP code and the associated YAML file.

    But hang on, if I'm reading this right, it's not the the service itself that the complaint is about, it's whatever is instantiating it that is at fault because it is supplying only 7 arguments when the code in the constructor for TermGlossaryHandlerPluginManager is clearly requiring 8?

    [15-Feb-2025 10:32:22 UTC] Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\term_glossary\Service\TermGlossaryManager::__construct(), 7 passed in C:\Users\nick\Sites\bit-by-bit.org\public_html\core\lib\Drupal\Component\DependencyInjection\Container.php on line 261 and exactly 8 expected" at C:\Users\nick\Sites\bit-by-bit.org\public_html\modules\contrib\term_glossary\src\Service\TermGlossaryManager.php line 72
    

    Also for clarity, I am not using Docker - I've always found it to be too sluggish so I simply use the good old native WAMP PRO for Windows.

  • πŸ‡«πŸ‡·France mably

    It looks like Drupal is not picking up the new services.yml for some reason...

    Some cache somewhere I guess.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    Experimentation continues...

    No other PHP error logs except the one I mention above.

    However, I have tried uninstalling the module and starting from scratch re-installing the DEV from the UI.

    It seems to install OK and the modules page refreshed afterwards confirming the install.

    But after a cache clear, I am seeing something new and different to before...

    [15-Feb-2025 11:08:04 UTC] Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginNotFoundException: "The "" plugin does not exist. Valid plugin IDs for Drupal\term_glossary\TermGlossaryHandlerPluginManager are: custom_js, default" at C:\Users\nick\Sites\bit-by-bit.org\public_html\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php line 53
    
  • πŸ‡«πŸ‡·France mably

    Ha, ha, nice one, I think we are almost there.

    Looks like you need to select the integration type on the module configuration page before using it.

    Some checks are missing, I'll work on that to avoid those crashes when the module is not configured yet.

  • πŸ‡«πŸ‡·France mably

    Problem should be fixed by πŸ› WSD when used without proper configuration. Active 🀞

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    @mably,

    Brilliant!

    Not only only does it address the issue, the Taxonomy Terms Glossary and Synonyms modules appear to working in perfect harmony ;-)

  • πŸ‡«πŸ‡·France mably

    Great news! Let's make that alpha7 release then πŸ˜€

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

Production build 0.71.5 2024