function newsletter_list_edit in Newsletter 7
Same name and namespace in other branches
- 7.2 modules/list/includes/newsletter_list.admin.inc \newsletter_list_edit()
Menu callback; edit a subscribers list.
2 string references to 'newsletter_list_edit'
- newsletter_list_add in includes/
newsletter.admin.inc - Menu callback; add a subscribers list.
- newsletter_menu in ./
newsletter.module - Implements hook_menu().
File
- includes/
newsletter.admin.inc, line 721 - Admin page callbacks for the newsletter module.
Code
function newsletter_list_edit($form, &$form_state, $list) {
if (isset($list->nlid)) {
$form['nlid'] = array(
'#type' => 'hidden',
'#value' => (int) $list->nlid,
);
}
$form['title'] = array(
'#type' => 'textfield',
'#default_value' => check_plain($list->title),
'#title' => 'Name',
'#weight' => -10,
'#required' => TRUE,
);
$form['send_rate'] = array(
'#type' => 'select',
'#options' => array(
'Custom' => t('Custom'),
'Manual' => t('Manual'),
'Daily' => t('Daily'),
'Weekly' => t('Weekly'),
'Monthly' => t('Monthly'),
),
'#default_value' => check_plain($list->send_rate),
'#title' => t('Send rate'),
);
$form['send_rate_custom'] = array(
'#attributes' => array(
'id' => array(
'send_rate_custom',
),
),
'#type' => 'textfield',
'#title' => t('Custom send rate'),
'#default_value' => is_numeric($list->send_rate) ? $list->send_rate : NULL,
'#maxlength' => 4,
'#size' => 4,
'#description' => t('Only fill this option if you selected "Custom" Send rate'),
'#field_prefix' => t('Once'),
'#field_suffix' => t('nodes of this list are published.'),
);
field_attach_form('newsletter_list', $list, $form, $form_state);
// Remove Basic Templates
$lang = $form['field_newsletter_template']['#language'];
unset($form['field_newsletter_template'][$lang]['#options'][1]);
unset($form['field_newsletter_template'][$lang]['#options'][2]);
unset($form['field_newsletter_template'][$lang]['#options'][3]);
$form['submit'] = array(
'#type' => 'submit',
'#value' => isset($list->nlid) ? t('Update') : t('Save'),
);
$form['cancel'] = array(
'#type' => 'link',
'#title' => t('Cancel'),
'#href' => 'admin/config/media/newsletter/lists',
);
$form['#list'] = $list;
return $form;
}