'fieldset', '#title' => t('Settings'), ); $form['general']['frequency'] = array( '#type' => 'select', '#title' => t('Display with frequency'), '#default_value' => $splash_when['frequency'], '#options' => array( '' => t('Never (off)'), 'always' => t('Always'), 'once' => t('Once'), 'daily' => t('Daily'), 'weekly' => t('Weekly'), ), '#description' => t('How often should visitors see the splash page?'), ); $form['general']['cookie'] = array( '#type' => 'radios', '#title' => t('Display on next visit'), '#description' => t('Reset the name of the cookie to force the display of the splash on next visit.'), '#options' => array( 0 => t('No'), 1 => t('Yes'), ), '#default_value' => 0, ); if (module_exists('condition')) { $form = array_merge($form, module_invoke('condition', 'selection_form', $splash_when['conditions'])); } $form = system_settings_form($form); unset($form['#submit']); return $form; } function splash_admin_when_submit($form, &$form_state) { if ($op == t('Reset to defaults')) { variable_del('splash_when'); drupal_set_message(t('The configuration options have been reset to their default values.')); } else { $splash_when = variable_get('splash_when', array()); $splash_when['frequency'] = $form_state['values']['frequency']; if ($form_state['values']['cookie']) { $splash_when['cookie'] = 'splash_cookie_'.time(); } if (module_exists('condition')) { $splash_when['conditions'] = $form_state['values']['conditions']; } variable_set('splash_when', $splash_when); drupal_set_message(t('The configuration options have been saved.')); } cache_clear_all(); drupal_rebuild_theme_registry(); } function splash_admin_what() { $splash_what = variable_get('splash_what', array()); $form['splash_what'] = array( '#tree' => TRUE, ); $form['splash_what']['mode'] = array( '#type' => 'select', '#title' => t('Content mode'), '#options' => array( '' => t('Pick random path or URL from the list'), 'sequence' => t('Pick next path or URL from the list'), 'template' => t('Display entered text in the site template'), 'fullscreen' => t('Display entered text/HTML full screen'), ), '#default_value' => $splash_what['mode'], '#description' => t('Determines how the content field below will be used.'), ); $form['splash_what']['content'] = array( '#type' => 'textarea', '#title' => t('Content'), '#default_value' => $splash_what['content'], '#description' => t('Text to show or paths/URLs (one on each line) to use.'), ); $form['splash_what']['filter'] = filter_form($splash_what['format']); $form['splash_what']['format'] = array( '#type' => 'value', '#value' => $splash_what['format'], ); $form['#submit'][] = 'splash_admin_what_submit'; return system_settings_form($form); } function splash_admin_what_submit($form, &$form_state) { $form_state['values']['splash_what']['format'] = $form_state['values']['format']; return $format_state; } function splash_admin_how() { $splash_how = variable_get('splash_how', array()); $options = array( '' => t('Redirect'), 'window' => t('New window'), ); if (module_exists('greybox')) { $options['greybox'] = t('Greybox'); } $form['splash_how'] = array( '#tree' => TRUE, ); $form['splash_how']['mode'] = array( '#type' => 'radios', '#required' => TRUE, '#title' => t('Display mode'), '#options' => $options, '#default_value' => $splash_how['mode'], '#description' => t('Redirect to the splash page, open it in a new window or in a fancy !greybox.', array('!greybox' => l(t('Greybox'), 'http://drupal.org/project/greybox'))), ); return system_settings_form($form); } ?>