Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Right know plugins' configFormValidate()
and configFormSubmit()
methods only get a &values
array as a parameter however $form_state would be also useful many times. For example if someone would like to redirect the user after a form submission he would be able to use $form_state['redirect'] instead of drupal_goto(). But this is just an example.
Comments
Comment #2
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThis is an interesting thought. The problem is though that
configFormValidate()
andconfigFormSubmit()
are not always called from the same form. It can be a form on the importer settings page, the standalone import form or a node form. As such, it becomes very unpredictable what is exactly in $form_state. Because of that, I think we shouldn't pass$form_state
to these methods.As an alternative, you can use a form alter hook to perform the needed extra logic, such as a redirect.
Do you agree with me?