-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing term definitions #5
Comments
Hi @storybynumbers which version of the plugin and Craft CMS do you run? |
For testing, I created a matrix field with a single block with one plain text field in it. Then I added this field to a section. Add an entry in the section and added multiple blocks with the field. In my template I added the following: {% for block in craft.entries.slug("my-first-article").one().matrix.all() %}
{{ block.contentField|glossary }}
{% endfor %}
{% hook 'glossary-terms' %} And this works as expected, Did I miss something? |
Hi @kringkaste, thanks for the quick response and sorry for my slow one!
I'm encountering the issue when there are multiple blocks. I have a page with three blocks, and only definitions from the last block are included in Some more context:
{% include '_blocks/blocks.twig' with { blocks: entry.blocks } %} This is my _blocks/blocks.twig template: {% for block in blocks.all() %}
{% set blockType = (block.type | kebab) %}
{% set file = '_blocks/' ~ blockType ~ '/' ~ blockType ~ '.twig' %}
{% include file with {block: block } %}
{% endfor %}
{% set glossary_lang = 'glossary_' ~ craft.app.locale|slice(0,2)|lower %}
{{ block.block1Text|glossary(glossary_lang) }} |
Hi @kringkaste, I was able to narrow the issue down. Every time the glossary filter is applied, the list of used terms is reset. It doesn't accumulate across multiple calls. So it's not an issue with the matrix field, it's an issue with applying the glossary multiple times. |
Hi @storybynumbers ! Thanks for the debugging and the PR. |
Fixed in release 1.0.6 for Craft 3 and 2.0.1 for Craft 4. Thanks for debugging and providing a PR! |
I am applying the glossary to a field within a repeating matrix block, and running into this error:
Words are underlined properly, but the
#glossary-terms
element is missing a number of definitions.The text was updated successfully, but these errors were encountered: