Skip to main content
added 3 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Line 844 could not think my_dossier_form is a class, except in the case $callback contains an array like array('my_dossier_form', 'methodName''mymodule_form');, or it contains a string like 'my_dossier_form::methodName'.

Line 844 could not think my_dossier_form is a class, except in the case $callback contains an array like array('my_dossier_form', 'methodName');, or it contains a string like 'my_dossier_form::methodName'.

Line 844 could not think my_dossier_form is a class, except in the case $callback contains an array like array('my_dossier_form', 'mymodule_form');, or it contains a string like 'my_dossier_form::methodName'.

fixed a link
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

The hook implementation done from a Drupal core module, for example comment_forms()comment_forms(), helps to understand the correct code.

The hook implementation done from a Drupal core module, for example comment_forms(), helps to understand the correct code.

The hook implementation done from a Drupal core module, for example comment_forms(), helps to understand the correct code.

explained what a better hook to use in the OP case is
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

As side note, the hook_forms() purpose is providing the same form builder for a group of forms whose ID follow a schema, such as in the case of comment edit forms, whose IDs are comment_node_[node type]_form. When provided, the form builder callback (passed as callback value) should build the full form, not part of it. The
The fact my_dossier_form() builds just a submission button, and my_dossier_forms() is using the same code used by node_forms() makes me think the code purpose is altering the node edit forms, which should be accomplished by implementing hook_form_BASE_FORM_ID_alter(). That's what the Book module does with book_form_node_form_alter(), which is invoked for the node edit form of every content type.

As side note, the hook_forms() purpose is providing the same form builder for a group of forms whose ID follow a schema, such as in the case of comment edit forms, whose IDs are comment_node_[node type]_form. When provided, the form builder callback (passed as callback value) should build the full form, not part of it. The fact my_dossier_form() builds just a submission button, and my_dossier_forms() is using the same code used by node_forms() makes me think the code purpose is altering the node edit forms, which should be accomplished by implementing hook_form_BASE_FORM_ID_alter(). That's what the Book module does with book_form_node_form_alter(), which is invoked for the node edit form of every content type.

As side note, the hook_forms() purpose is providing the same form builder for a group of forms whose ID follow a schema, such as in the case of comment edit forms, whose IDs are comment_node_[node type]_form. When provided, the form builder callback (passed as callback value) should build the full form, not part of it.
The fact my_dossier_form() builds just a submission button, and my_dossier_forms() is using the same code used by node_forms() makes me think the code purpose is altering the node edit forms, which should be accomplished by implementing hook_form_BASE_FORM_ID_alter(). That's what the Book module does with book_form_node_form_alter(), which is invoked for the node edit form of every content type.

explained what a better hook to use in the OP case is
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Loading
made the answer more explicit about when the error happens
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Loading
made the answer more explicit about what happens when two modules return data about the same form ID, in hook_forms()
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Loading
Post Undeleted by avpaderno
added 2349 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Loading
Post Deleted by avpaderno
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Loading