The function metatag_get_route_entity() is causing fatal error on my entity form since it calls Drupal::entityTypeManager()->getDefinition($entity_type); without checking if the entity does exist.

My route name is mymodule.my_entity.add and the module tries to get definition for mymodule.my_entity entity. I am not sure what is the use of this method(I haven't look into the code that much), but I think that it should use route parameters instead of guessing.

Either try to get the entity object directly(if the entity route decorator has been applied) or try to match the parameter name with entity definition.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

ivanjaros created an issue. See original summary.

Anonymous’s picture

FileSize
2.42 KB
DamienMcKenna’s picture

Status: Needs work » Needs review

The correct status for when you upload a patch file is "needs review".

Thanks for the patch, I'll take a look at this soon.

Status: Needs review » Needs work

The last submitted patch, 2: 2842092-metatag-route-entity.patch, failed testing.

Anonymous’s picture

Yeah I know, I must have "overclicked" :)

Anyway, I wonder if there's a case when route does not have entity parameter set via entity decorator but metatags should be used?
Maybe scanning through the link templates in entity definitions could be a working approach...dunno.

DamienMcKenna’s picture

The patch didn't apply, if can you could please update the patch against the current -dev release so that we can run the tests, that'll help determine if this could be a possible solution.

DamienMcKenna’s picture

Lets see how the tests actually work.

Status: Needs review » Needs work

The last submitted patch, 7: metatag-n2842092-7.patch, failed testing.

DamienMcKenna’s picture

The tests are failing for other reasons, other patches are failing with the same errors.

DamienMcKenna’s picture

Status: Needs work » Postponed (maintainer needs more info)

Can you please test out the current -dev snapshot to see if the problem still exists?

DamienMcKenna’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

I think this problem was solved elsewhere.