I get "Drupal\Core\Entity\Exception\UndefinedLinkTemplateException" on adding an Entity Reference of type Action such as "Make content sticky", and then saving gives an Error.
In a fresh install, in Structure, I edit the basic Article type:
- A new field of type Entity Reference
- Type of item to reference = Action
- Reference method = Default
Then Create new content of type Article
- Enter the required Title = Test
- Enter new Entity Reference = "Make content sticky (node_make_sticky_action)"
- And click Save
I see:
Error
The website has encountered an error. Please try again later.
Status message
Article Test has been updated.
And the Error log shows:
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template "edit-form" found for the "action" entity type in Drupal\Core\Entity\Entity->urlInfo() (line 188 of /var/www/vhosts/my-directory/drupal8/core/lib/Drupal/Core/Entity/Entity.php).
I think it occurs if I select any Action.
Comments
Comment #1
iantresman commentedStill present in beta 3
Comment #2
berdirThis doesn't seem like a critical/release-blocking bug to me. What is your use case to reference an action?
Comment #3
iantresman commentedI would have thought that any PHP error would be considered critical?
Comment #4
berdirSee https://www.drupal.org/node/45111 on how the priority is defined, it is only critical if it renders the whole system unusable. One broken feature that I think is not very frequently used does IMHO not qualify as breaking the whole system.
Comment #5
iantresman commentedThanks for the link, I agree with the guidelines.
Comment #6
amateescu commentedThis should fix it. Tests will need to be added after #2370703: ER's "autocreate" feature is mostly broken (and untested) gets in.
Comment #7
berdirI find it very annoying that config entities overide urlInfo() and set the default to edit-form.
If it would not, then instead of checking against the exception, we could simply check for the existence of 'canonical' directly.
Comment #8
iantresman commented@amateescu. Well done, that fixed it for me, no error. My new content now displays "Make content sticky".
I am not sure I was expecting the label. I thought maybe, I'd get either:
Comment #9
amateescu commented@Berdir, I see your point but the fact is that most config entities don't have a 'canonical' link so 'edit-form' is the next best thing.
@iantresman, well, the default formatter for entity reference fields is
entity_reference_labelso I'm not sure why someone would expect anything else than the label :)Comment #10
iantresman commented"the default formatter for entity reference fields is entity_reference_label"
Ah yes, I see that now. It just looks odd when most other fields point to their contents (value).
Comment #11
amateescu commentedHere's the test I promised earlier.
@Berdir, thinking about it more, even if ConfigEntityBase wouldn't override urlInfo(), any other (custom) entity class could do that so checking against the exception is still the right thing to do :)
Comment #14
amateescu commentedNot sure what happened there, let's try again.
Comment #16
amateescu commentedWho wants to press the RTBC button? :)
Comment #17
berdirRight.
Let's just fix it like this then.
Comment #18
alexpottCommitted 7c6a23f and pushed to 8.0.x. Thanks!