You are here

function christmas_lights_settings in Christmas Lights 7

Form builder function for module settings.

5 string references to 'christmas_lights_settings'
christmas_lights_install in ./christmas_lights.install
Implements hook_install().
christmas_lights_menu in ./christmas_lights.module
Implements hook_menu().
christmas_lights_page_build in ./christmas_lights.module
Implements hook_page_build().
christmas_lights_settings_submit in ./christmas_lights.module
Process christmas_lights_settings submissions.
christmas_lights_uninstall in ./christmas_lights.install
Implements hook_uninstall().

File

./christmas_lights.module, line 26
Main file for the christmas_lights module.

Code

function christmas_lights_settings() {
  $settings = variable_get('christmas_lights_settings');
  $start = array(
    'day' => date('j', $settings['start']),
    'month' => date('n', $settings['start']),
    'year' => date('Y', $settings['start']),
  );
  $end = array(
    'day' => date('j', $settings['end']),
    'month' => date('n', $settings['end']),
    'year' => date('Y', $settings['end']),
  );
  $form['enabled'] = array(
    '#type' => 'checkbox',
    '#default_value' => $settings['enabled'],
    '#title' => t('Enable christmas lights'),
  );
  $form['start'] = array(
    '#type' => 'date',
    '#title' => t('Start date'),
    '#default_value' => $start,
    '#description' => t('The date your enable christmas lights'),
    '#required' => TRUE,
  );
  $form['end'] = array(
    '#type' => 'date',
    '#title' => t('Finish date'),
    '#default_value' => $end,
    '#description' => t('The date your disable christmas lights'),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Configuration'),
  );
  return $form;
}