Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm not sure if there is a better way but I choose to extend the metatag module - https://www.drupal.org/sandbox/kalpaitch/2781475 - to allow plugin derivatives for tags such that they could be created from some other source, primarily to enable new tags to be added from config or other non-code sources.
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff-2781485-11-12-do-not-test.diff | 1.38 KB | kalpaitch |
#12 | metatag-plugin-ids-2781485-12.patch | 4.6 KB | kalpaitch |
|
Comments
Comment #2
DamienMcKennaThat would be really awesome!
Comment #3
kalpaitch CreditAttribution: kalpaitch as a volunteer and at Eurostar commentedHowever, when doing this I discovered that in MetatagManager class the form method assumes that the array keys returned by the sortedTags method are plugin IDs, this is actually not the case when using derivatives as in my example module above. I don't know whether this is intentional or if there is some other way, but I wanted to submit this patch to allow plugin derivatives for metatag tags.
Comment #4
kalpaitch CreditAttribution: kalpaitch as a volunteer and at Eurostar commentedActually given this stops derivers from being used I'm going to label this as something other than a feature request...
Comment #5
DamienMcKennaNo, this is a feature request, the module was not designed with this functionality in mind.
Comment #6
kalpaitch CreditAttribution: kalpaitch as a volunteer and commentedCould I raise this as an important patch because the use of 'id' as the plugin name is not 100% accurate, the 'name' property represents the plugin name. Thanks.
Comment #7
kalpaitch CreditAttribution: kalpaitch as a volunteer and commentedComment #8
kalpaitch CreditAttribution: kalpaitch as a volunteer and commentedIf the same plugin (id) is used for more than one instance (derivatives) then the MetatagManager will currently just hand back the last of these instances and ignore the rest.
This sort of fits in the grey area between bug and feature request, plugins definitions are originally keyed by name and not id, would be grateful if you had another look, thanks.
Comment #9
DamienMcKennaJust to see, lets try changing the group handling too.
Comment #11
kalpaitch CreditAttribution: kalpaitch as a volunteer and commentedYes, the groups also needed changing. I've made a few small updates to your patch.
Comment #12
kalpaitch CreditAttribution: kalpaitch as a volunteer and commentedComment #13
DamienMcKennaI'm honestly not sure. I might just commit path #12 as-is, but I need to think through your question.
Comment #14
kalpaitch CreditAttribution: kalpaitch as a volunteer and commentedBeen thinking about this a bit more and I think it works having both plugin id and instance id. Leaving as-is.
Comment #16
DamienMcKennaCommitted. Thanks!