Problem/Motivation
From entity.api.php:
- defaults: For entity form routes, use _entity_form rather than the generic _controller or _form.
Unfortunately we do not follow this directive and have some places where we define an entity form through a controller, which then retrieves the form through the entity form builder.
Actually we don't need the controller at all, as _entity_form takes care of everything.
This is also a contributed project blocker. autosave_form gets active only on _entity_form routes. This is the case for the entity.node.edit_form
route. However there is the feature request to make autosave_form active also for new entities on the add page. As the node.add route is defined through _controller instead through _entity_form this is not possible.
Proposed resolution
Switch from _controller to _entity_form and deprecate the controller. The change should be completely safe as we don't have any logic inside \Drupal\node\Controller\NodeController::add()
.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#13 | 3084030-13.patch | 1.68 KB | hchonov |
Comments
Comment #2
hchonovComment #3
hchonovComment #4
hchonovComment #5
vijaycs85+1 to RTBC. probably needs a CR?
Comment #6
hchonovDone - https://www.drupal.org/node/3084856
Comment #7
jibranWe need to trigger the warning pointing to the change record to let people know to stop using it and we also need deprecation tests for this as well.
Comment #8
jibranWe can also move the rotue defination to
\Drupal\node\Entity\NodeRouteProvider
. Or maybe a followup.Comment #9
jibranSeems like a duplicate of #2723579: [PP-1] NodeRouteProvider should extend DefaultHtmlRouteProvider.
Comment #10
hchonovThis issue here is pretty small and blocking a contrib project. Let's please not mix it up with a much bigger one.
Comment #11
jibranI guess we can reroll #2723579: [PP-1] NodeRouteProvider should extend DefaultHtmlRouteProvider on top of this. Setting it RTBC so that we can unblock contrib.
Comment #12
catchDiscussed briefly with @alexpott, I don't think we need a deprecation test because controllers are internal (it's a similar change to when we add bc for constructors), but this does need a @trigger_error() within the deprecated method.
Comment #13
hchonovOh, right. Setting back to RTBC as this is actually a very minor change.
Comment #14
tstoecklerRTBC++
I agree with this being fine to go in independently of #2723579: [PP-1] NodeRouteProvider should extend DefaultHtmlRouteProvider. In fact that would need to deprecate the controller as well, so at least with that part this issue will actually make that smaller.
Comment #16
catchCommitted 78251c4 and pushed to 8.8.x. Thanks!
Comment #17
jibranPublished the change notice as well.