Closed (duplicate)
Project:
Metatag
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2016 at 19:44 UTC
Updated:
28 Oct 2016 at 21:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
replicaobscuraAttached is a patch which implements a new hook, metatag_entity_add_routes, which returns an array of route_name => entity_type. Metatag then checks that map first, and falls back to attempting to automatically determine the entity type if not specified.
This works for me exactly as it did before without any further modification. However, it also works to easily support any custom entities which previously had route names which used a different pattern by implementing a hook in a custom module (or, ultimately, in whatever module is adding that route would be best).
I've tested this quite a bit on beta10 but just now implemented it on top of 8.x-1.x, so if anything is not working right, the patch may need to be updated to account for changes since beta10.
I know there should probably be an API file which defines how to use the new hook, but since I don't even know if this is the best approach, I wanted to get some feedback first.
Comment #3
replicaobscuraMay be overkill, but I had some incorrect text a function comment that I've fixed in this version of the patch.
Comment #4
replicaobscuraAttached is a version of the patch that I've re-rolled specifically for beta10 for anyone needing to use this in a production site and isn't comfortable with using the dev release.
Comment #5
replicaobscuraI've over-complicated this--I don't think a hook is needed at all the more I look into it. Instead, metatag just needs to take into account Drupal's standard entity route naming scheme to be able to support pretty much any entity's add/edit form. Rolling a new patch shortly.
Comment #6
replicaobscuraComment #7
replicaobscuraComment #8
replicaobscuraComment #9
replicaobscuraThe more I think about it, I should just roll a new patch in https://www.drupal.org/node/2654148 that fixes this rather than have multiple patches floating around for adding custom entity support. I'm going to go there instead.
Comment #10
replicaobscura