thosewhatnots is completely perfectly correct when discussing the difference between $form and $form_state . $form defines the form, $form_state carries information about the processed form.
So, why do form-building functions accept $form_state as their first argument (along with any number of optional user-defined arguments)? Provide information about the state and condition that may be needed when creating the form.
Form building functions should always return a form definition , but they can make decisions about form definition based on information such as the last button clicked, user values, or other information. As mentioned in ceejayoz's comments, the general use of $form_state in the builder function is to handle multi-stage forms in which the state of the form ("step 1 + 2 is complete, step 3 should still go") has an effect in the form displayed to the user.
In many common use cases, $form_state completely ignored, and optional arguments are used to provide contextual information (for one of many examples, see comment_form ).
source share