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 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 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 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 commentedComment #8
kalpaitch 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 commentedYes, the groups also needed changing. I've made a few small updates to your patch.
Comment #12
kalpaitch 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 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!