While an entity type's form controller class might be the primary form by which to edit an entity, it should be possible to create additional forms: for example, an in-place editing form, as in #1824500: In-place editing for Fields. Also, entities can be edited outside of forms entirely, via RESTful web services, as in #1826688: REST module: PATCH/update.

What is currently done by hook_node_prepare() and friends has nothing to do with forms: it's just about doing further manipulation of $node that wasn't done in node_load() for various reasons (performance, idempotence).

So, this patch moves it to the entity class itself.

Files: 
CommentFileSizeAuthor
#3 entity_prepare.patch6.65 KBeffulgentsia
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_prepare_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
entity_prepare.patch6.03 KBeffulgentsia
FAILED: [[SimpleTest]]: [MySQL] 48,741 pass(es), 453 fail(s), and 174 exception(s).
[ View ]

Comments

Note that the above patch doesn't move the implementation of ViewFormControllerBase::prepareEntity(), because there seems to be a little more coupling there to the form itself. For example, the "add" and "clone" forms skip that preparation.

Status:Needs review» Needs work

The last submitted patch, entity_prepare.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new6.65 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_prepare_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

ViewUI is a strange class.

#3: entity_prepare.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, entity_prepare.patch, failed testing.