function mcd_form_alter in Maintenance Countdown 7
Implements hook_form_alter().
File
- ./
mcd.module, line 84 - mcd.module
Code
function mcd_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'system_site_maintenance_mode') {
$form['mcd'] = array(
'#type' => 'fieldset',
'#title' => t('Maintenance Countdown settings'),
'#weight' => 1,
'#collapsible' => TRUE,
'#element_validate' => array(
'mcd_form_validate',
),
);
$form['mcd']['help_info'] = array(
'#markup' => '<p>' . t('Here you may set maintenance time. i.e. how long site will be offline. For example, if you plan switch
site offline for 5 minutes, enter \'5\' (without apostrophes) in "Minutes" field. If you need 100 hours, just do it — feel
free to enter \'100\' (without apostrophes) in "Hours" field.') . '</p>',
);
$form['mcd']['mcd_months'] = array(
'#title' => t('Month(s)'),
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('mcd_months', NULL),
'#prefix' => '<div class="mcd">',
);
$form['mcd']['mcd_days'] = array(
'#title' => t('Day(s)'),
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('mcd_days', NULL),
);
$form['mcd']['mcd_hours'] = array(
'#title' => t('Hours(s)'),
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('mcd_hours', NULL),
);
$form['mcd']['mcd_minutes'] = array(
'#title' => t('Minute(s)'),
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('mcd_minutes', NULL),
);
$form['mcd']['mcd_seconds'] = array(
'#title' => t('Seconds'),
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('mcd_seconds', NULL),
'#suffix' => '</div>',
);
$form['mcd']['mcd_time_up_message'] = array(
'#title' => t('Message after time is up'),
'#type' => 'textarea',
'#default_value' => variable_get('mcd_time_up_message', t('Time is up. Please reload this page by hitting <kbd>F5</kbd> on your keyboard or click on "Reload" button below.')),
'#description' => t('Write some message that will be shown after time is up. HTML allowed.'),
);
// Reload settings
$form['mcd']['reload_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Maintenance page reload settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['mcd']['reload_settings']['mcd_reload_button'] = array(
'#type' => 'radios',
'#default_value' => variable_get('mcd_reload_button', 0),
'#options' => array(
t('Show reload button'),
t("Don't show reload button"),
t("Don't show reload button, but add auto-reloading maintenance page every 15 seconds after time is up"),
),
);
// Page theme setings
$form['mcd']['theme_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Maintenance page customization'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['mcd']['theme_settings']['mcd_page_themes'] = array(
'#type' => 'select',
'#title' => t('Select page theme'),
'#default_value' => variable_get('mcd_page_themes', 'light'),
'#options' => array(
'light' => t('Light'),
'dark' => t('Dark'),
),
);
$form['mcd']['theme_settings']['mcd_site_logo'] = array(
'#type' => 'checkbox',
'#title' => t('Hide site logo'),
'#default_value' => variable_get('mcd_site_logo', 0),
);
$form['mcd']['theme_settings']['mcd_site_name'] = array(
'#type' => 'checkbox',
'#title' => t('Hide site name with link'),
'#default_value' => variable_get('mcd_site_name', 0),
);
$form['mcd']['theme_settings']['mcd_site_slogan'] = array(
'#type' => 'checkbox',
'#title' => t('Hide site slogan'),
'#default_value' => variable_get('mcd_site_slogan', 0),
);
if (mcd_check_simplenews()) {
$form['mcd']['emailsubs_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Subscription form settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['mcd']['emailsubs_settings']['mcd_email_subscr'] = array(
'#type' => 'select',
'#title' => t('Select form to be shown on maintenance page'),
'#options' => array(
t('<none>'),
) + simplenews_category_list(),
'#default_value' => variable_get('mcd_email_subscr', 0),
);
$form['mcd']['emailsubs_settings']['mcd_email_place'] = array(
'#description' => t('If you want some placeholder for email field, so type it here.'),
'#type' => 'textfield',
'#title' => t('Placeholder for email field'),
'#default_value' => variable_get('mcd_email_place'),
);
}
$form['#submit'][] = 'mcd_submit';
}
if ($form_id == 'simplenews_block_form_' . variable_get('mcd_email_subscr') && variable_get('mcd_email_place')) {
$form['mail']['#attributes'] = array(
'placeholder' => variable_get('mcd_email_place'),
);
}
}