开发者

Drupal hook alter with hook validate

开发者 https://www.devze.com 2022-12-27 06:43 出处:网络
I hav开发者_如何学Pythone a CCK defined form called \'mytype_node_form\'. I create a module called form_overrides

I hav开发者_如何学Pythone a CCK defined form called 'mytype_node_form'.

I create a module called form_overrides

I create a function called form_overrides_form_alter where I successfully check for $form_id = 'mytype_node_form'

Question:

What should be the name of my validation function (hook_validate) in module form_overrides that would allow me to add custom validation to form mytype_node_form?

I thought it should look something like this

function form_overrides_mytype_node_form_validate($form, &$form_state) or

function form_overrides_validate($form, &$form_state)


If you don't specify the validation function in $form['#validate'], then Drupal looks for a function named with the form ID plus "_validate". So in this case it would be looking for mytype_node_form_validate() (and similarly mytype_node_form_submit() for the submit function).

0

精彩评论

暂无评论...
验证码 换一张
取 消