Problem/Motivation
Link property of metatags object is empty.
{
"title": "[de] test translation wf",
"messages": [],
"breadcrumbs": [
{ ... }
],
"metatags": {
"meta": [],
"link": []
},
Proposed resolution
CustomElementsMetatagsGenerator should take care of some configuration entities as well.
Result should look sth like this:
{
"title": "[de] test translation wf",
"messages": [],
"breadcrumbs": [
{ ... }
],
"metatags": {
"meta": [],
"link": [
{
"rel": "alternate",
"hreflang": "de",
"href": "https://admin--example.ldp-project.localdev.space/de/form/test-translation-wf"
},
{
"rel": "alternate",
"hreflang": "en",
"href": "https://admin--example.ldp-project.localdev.space/form/test-translation-wf"
}
]
},
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3410567-lupus_ce_renderer_webforms-are-missing-12.patch | 1.84 KB | useernamee |
| #3 | 3410567-lupus_ce_renderer_webforms-are-missing-2.patch | 1.5 KB | useernamee |
Issue fork lupus_ce_renderer-3410567
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
useernamee commentedI've lessened the condition for metatags links generation. Check PR.
I'm also adding a patch file.
Comment #4
useernamee commentedComment #5
useernamee commentedThis solution works for me, but I've just figured it out that it only adds webform translations if content_translation module is installed which is not optimal. https://git.drupalcode.org/project/lupus_ce_renderer/-/merge_requests/33...
This condition might need some more consideration.
Comment #6
fago> if (array_diff(['hasLinkTemplate', 'getTranslationLanguages'], get_class_methods($entity)) &&
This should check for the dedicated interface we need. each method should be provided by a suiting more narrow interface, content-entity-interface is a collection of those. Let's checked for the specific ones with an OR statement so this is a) nicer and b) easier to follow
> This solution works for me, but I've just figured it out that it only adds webform translations if content_translation module is installed which is not optimal. https://git.drupalcode.org/project/lupus_ce_renderer/-/merge_requests/33...
This is not really nice, indeed, but I think good enough. In practice only people having that module installed will want to have these metatags, so let's just keep doing it that way.
Comment #7
useernamee commentedAlternatively we could use:
but I don't like this solution either.
getTranslationLanguagesis defined on WebformInterface and the problem with this is that it is too specific for my taste. It might cause issues if webform is not installed. What would be proper fix would be to open an issue on webform to implement some proper translation interface with needed method.ContentEntityInterface(ultimately) inherits the method fromweb/core/lib/Drupal/Core/TypedData/TranslatableInterface.phpbut that is not the case for Config entities.Comment #8
useernamee commentedComment #9
fagoCould we do something like
if (($entity instanceof ContentEntityInterface ||
(class_exists(WebformInterface) && $entity instanceof WebformInterface))
? so we keep the check clean on interfaces, but still do work fine if webform module is not there. It also better documents why we are doing this. (webform)
Comment #11
useernamee commentedI've implemented the last comment.
Comment #12
useernamee commentedI've created the new patch.
Comment #14
useernamee commentedmerged