Spin off from #1499596-113: Introduce a basic entity form controller:

+++ b/core/modules/comment/comment.module<br>+function comment_add($node, $pid = NULL) {
+  $values = array('nid' => $node->nid, 'pid' => $pid, 'node_type' => 'comment_node_' . $node->type);
+  $comment = entity_create('comment', $values);
+  return entity_get_form($comment);
Shouldn't this pass the full $node object sorta as an additional "context" into entity_get_form()? That's a more complex case, which we can happily discuss in a follow-up.

We probably need to accept a dynamic list of arguments as drupal_get_form() does and forward it to EntityFormController::build().


sun’s picture

Issue tags: +WSCCI

Yeah, I was basically thinking of an associative $context array, similar to the one we're using for drupal_alter() as well as token_replace().

That said, I wonder what @Crell & Co. has to say about this, as this sorta seems to be "some kind of an external data source" being passed into an entity form. In Panels-speak, it would be a "required context" (since the comment form is not able to work without a parent/context entity; i.e., you cannot comment on "nothing").

andypost’s picture

There's no issue now but it make sense to get rid of comment_add() function here

andypost’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)
Crell’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

I don't think this issue is still relevant. If someone disagrees, reopen with an explanation of what actually needs to be done at this point. Note that adding a drupal_alter() call to the route dispatch process is a non-starter.