API page: https://api.drupal.org/api/drupal/core%21modules%21system%21core.api.php...

On #2225353: Convert $form_state to an object and provide methods like setError(), $form_state was changed from an array to an object of type \Drupal\Core\Form\FormStateInterface instead of an array.

That issue fixed up the documentation pretty well, but missed two things:

a) At the bottom of the Form generation topic (link above), there's a line:

See \Drupal\Core\Form\FormBuilder::buildForm() for documentation of $form_state keys.

I think we should remove this line, and instead say at the end of the previous paragraph:

$form_state is an object that implements \Drupal\Core\Form\FormStateInterface.
b) Although the form state interface is now used in examples on this page, there is no use statement for it in the form class example at the top.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

er.pushpinderrana’s picture

Status: Active » Needs review
FileSize
1.21 KB

Please review updated patch.

jhodgdon’s picture

Status: Needs review » Needs work

Oh, sorry. I think the new information should be added to the last paragraph (which is talking about $form_state), not the paragraph above that you added it to. Sorry that wasn't clear!

undertext’s picture

Status: Needs work » Needs review
FileSize
931 bytes
jhodgdon’s picture

Status: Needs review » Needs work

Thanks, almost there!

  * In the form builder, validation, submission, and other form methods,
  * $form_state is the primary influence on the processing of the form and is
  * passed by reference to most methods, so they can use it to communicate with
- * the form system and each other.
+ * the form system and each other. $form_state is an object that implements
+ * \Drupal\Core\Form\FormStateInterface.
  *
- * See \Drupal\Core\Form\FormBuilder::buildForm() for documentation of
- * $form_state keys.
  */
 

I realized we should take out the "by reference" note in this paragraph -- it's an object, so that is not necessary to mention that it is passed by reference.

Also, we do not need the blank line at the end of the doc block, so that should be removed.

er.pushpinderrana’s picture

Status: Needs work » Needs review
FileSize
1002 bytes

Please review updated patch, incorporated #4 changes.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Looks good to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 402e037 and pushed to 8.x. Thanks!

  • alexpott committed 402e037 on 8.0.x
    Issue #2313089 by er.pushpinderrana, undertext | jhodgdon: Fixed Form...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

m1r1k’s picture

Issue tags: +#ams2014contest