Tuesday, May 17, 2011

Create Dynamic Define variables in Drupal

/**
 * Implementation of hook_menu().
 */
function addons_menu() {       
    $items['admin/links/admin_email'] = array(
        'title' => 'Admin Email Settings',
        'description' => 'Control how Drupal deals with Admin Email Address',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('get_admin_email_address'),
        'access arguments' => array('admin email address'),
       );
}

/* Start of custom form creation for Admin
 * -> Admin Panel

 * -> Admin Email Settings
 */
function get_admin_email_address(){
  $form['admin_email_settings'] = array(
    '#type' => 'fieldset',
    '#title' =>  t('Admin Email Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $form['admin_email_settings']['registration_email_address'] = array(
    '#type' => 'textfield',
    '#title' =>  t('Registration Email Address'),
    '#description' => t('Enter Registration email address'),
    '#default_value' => variable_get('registration_email_address', ''),
  );

  return system_settings_form($form);
}
/* End of custom form creation for admin email settings*/

No comments:

Post a Comment

Followers