How hook_form_alter works in drupal7 ?

| Last Updated: | In: Drupal, Drupal Beginners


Working strategy of hook_form_alter

This hook perform the alterations before the form is submitted or rendered. This hook hook_form_alter($form, $form_state, $form_id), this hook has 3 parameters

1) $form: Nested array of form elements that comprise the form.
2) $form_state: A keyed array containing the current state of the form. The arguments that drupal_get_form() was originally called with are available in the array $form_state[‘build_info’][‘args’].
3) $form_id: This id should be match to the id of that form, that have to randred by this module.

Now you can create module using this hook to learn it more:
If you are familiar to module development in drupal7, then you can get it easily. First of all you have to create the info file for your module like

name = My Form Alter
description = This is the module using form alter to make changes for the exsiting form
package = custom
core = 7.x

and then you have to create the module file for that

Tags:



You may also like:

Get Free Access of 500+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Free Guide: Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Free WordPress Setup Service

Free WordPress Setup

Want to Setup WordPress Blog Setup? I will help you in the setup of your WordPress blog.

Click Here

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW