function mailing_list_form in Mailing List 7
Same name and namespace in other branches
- 6 mailing_list.admin.inc \mailing_list_form()
Form for adding / renaming a mailing list.
1 string reference to 'mailing_list_form'
- mailing_list_menu in ./
mailing_list.module - Implement hook_menu().
File
- ./
mailing_list.admin.inc, line 200 - Mailing list admin UI.
Code
function mailing_list_form($form, &$form_state, $list = null) {
if (empty($list)) {
drupal_set_title(t('Add mailing list'));
}
else {
drupal_set_title(t('Edit mailing list'));
}
$form = array();
if (isset($form_state['values']['mlid']) || !empty($list)) {
$form['mlid'] = array(
'#type' => 'hidden',
'#value' => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid : null,
);
}
$form['name'] = array(
'#title' => t('List name'),
'#type' => 'textfield',
'#required' => TRUE,
'#default_value' => isset($form_state['values']['name']) ? $form_state['values']['name'] : isset($list) ? $list->name : '',
);
$form['submit'] = array(
'#value' => t('Save'),
'#type' => 'submit',
'#submit' => array(
'mailing_list_form_submit',
),
);
$form['#redirect'] = 'admin/structure/mailing-list';
return $form;
}