function node_expire_settings_form in Node expire 6
Same name and namespace in other branches
- 5 node_expire.module \node_expire_settings_form()
Configuration form for node_expire
1 string reference to 'node_expire_settings_form'
- node_expire_menu in ./
node_expire.module - Implementation of hook_menu().
File
- ./
node_expire.admin.inc, line 11 - Module settings.
Code
function node_expire_settings_form() {
// Publishing settings section
$form['general'] = array(
'#title' => t('General Settings'),
'#type' => 'fieldset',
'#tree' => FALSE,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$expireperiod = drupal_map_assoc(array(
0,
1,
86400,
172800,
259200,
345600,
432000,
518400,
604800,
691200,
777600,
864000,
950400,
1036800,
1123200,
1209600,
), 'format_interval');
$expireperiod[0] = 'Never';
$expireperiod[1] = 'Instantly';
$form['general']['node-expire-unpublishtime'] = array(
'#title' => t('Timeout for automatic unpublishing'),
'#description' => t('The duration of time when a node is expired for it to become automatically unpublished. Notice: Unpublished documents won\'t trigger any expiration notices.'),
'#type' => 'select',
'#options' => $expireperiod,
'#default_value' => variable_get('node-expire-unpublishtime', 0),
);
// Only allow inheritance for book pages.
if (module_exists('book')) {
$form['general']['node-expire-book-props'] = array(
'#title' => t('Book pages - Inheritance'),
'#description' => t('Enable inheritance/propagation of expiration times amongst child books.'),
'#type' => 'select',
'#options' => array(
1 => 'Yes',
0 => 'No',
),
'#default_value' => variable_get('node-expire-book-props', 1),
);
}
// Notification settings section
$form['notify'] = array(
'#title' => t('Notifications'),
'#type' => 'fieldset',
'#tree' => FALSE,
'#collapsible' => TRUE,
'#collapsed' => variable_get('node-expire-enable-email', 1) == 0,
);
$form['notify']['node-expire-enable-email'] = array(
'#title' => t('Enable email notifications'),
'#description' => t('Whether or not to e-mail out about expired nodes.'),
'#type' => 'select',
'#options' => array(
1 => 'Yes',
0 => 'No',
),
'#default_value' => variable_get('node-expire-enable-email', 1),
);
$period = drupal_map_assoc(array(
86400,
172800,
259200,
345600,
432000,
518400,
604800,
), 'format_interval');
$form['notify']['node-expire-renotify'] = array(
'#title' => t('Re-notify user every'),
'#description' => t('The length of time before the user is renotified of old content.'),
'#type' => 'select',
'#options' => $period,
'#default_value' => variable_get('node-expire-renotify', 259200),
);
$form['notify']['node-expire-cc'] = array(
'#title' => t('Carbon Copy Address'),
'#description' => t('An e-mail address to carbon copy on all notifications.'),
'#type' => 'textfield',
'#size' => 50,
'#default_value' => variable_get('node-expire-cc', ''),
);
// E-mail content settings
$form['notify']['email'] = array(
'#title' => t('E-mail Content'),
'#type' => 'fieldset',
'#tree' => FALSE,
'#collapsible' => TRUE,
'#collapsed' => variable_get('node-expire-enable-email', 1) == 0,
);
$form['notify']['email']['node-expire-subject'] = array(
'#title' => t('Subject'),
'#description' => t('The subject of the automated alerts. Available variables are: !site'),
'#type' => 'textfield',
'#size' => 60,
'#maxlength' => 180,
'#default_value' => variable_get('node-expire-subject', '!site - Article Update Needed'),
);
$form['notify']['email']['node-expire-body'] = array(
'#title' => t('Body'),
'#description' => t('The body of the automated alerts. Available variables are: !username !start_section! !stop_section! !section_article !section_timesinceupdate !section_lastupdate !section_expirydate !section_nodelink !section_editlink'),
'#type' => 'textarea',
'#rows' => 11,
'#cols' => 60,
'#default_value' => variable_get('node-expire-body', "Hello !username,\r\n\r\nThe following article(s) are in need for reviewing and updating. Please update these at your earliest convenience. If no changes are necessary, simply open the editor and press 'Save'.\r\n\r\n!start_section!\r\nArticle: !section_article\r\nTime since update: !section_timesinceupdate\r\nEdit Link: !section_editlink\r\n\r\n!stop_section!\r\n-- !site team"),
);
// Use the Drupal's standard
$form = system_settings_form($form);
$form['#validate'][] = 'node_expire_settings_form_validate';
return $form;
}