Form API skeleton for Drupal


Rakesh Kumar

/** * Implements hook_menu() */ function mymodule_menu() { $items = array(); $items['admin/config/../..'] = array( 'title' => '', 'type' => MENU_NORMAL_ITEM, 'page callback' => 'drupal_get_form', 'page arguments' => array('…_form'), 'access arguments' => array('...'), ); return $items; } function …_form($form, &$form_state) { $form = array(); $form['…'] = array( '#type' => 'fieldset', '#collapsible' => FALSE, '#title' => t('...'), '#description' => t('...'), ); $form['… ']['…'] = array( '#type' => 'textfield', '#title' => t(''), '#description' => t('... !n …', array('!n' => )), '#default_value' => variable_get('', ), '#required' => TRUE ); $form['… ']['…'] = array( '#title' => '...', '#description' => t(''), '#type' => 'select', '#options' => array( '...' => t('...'), '...' => t('...'), ), '#default_value' => variable_get('...', '...'), ); $form['…']['…'] = array( '#type' => 'radios', '#required' => TRUE, '#default_value' => ..., ); $form['…']['…'] = array( '#type' => 'item', '#markup' => t('..%item..', array('%item' => ..)), ); return system_settings_form($form); } function …_form_validate($form, &$form_state) { if (...) { form_set_error(''…

View original post 7 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s