<?php

/**
 * @file
 * Custom EclipseCon settings.
 */

/**
 * Implements hook_form_system_theme_settings_alter().
 *
 * @param array $form
 *        Nested array of form elements that comprise the form.
 * @param array $form_state
 *        A keyed array containing the current state of the form.
 */
function solstice_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL) {
  // Work-around for a core bug affecting admin themes. See issue #943212.
  if (isset($form_id)) {
    return;
  }

  $form['solstice'] = array(
    '#type' => 'fieldset',
    '#title' => t('Solstice configurations'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#weight' => -99
  );

  $options = array(
    t('Default'),
    t('Right')
  );

/*
  $form['solstice']['solstice_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Menu placement'),
    '#description' => t('Choose menu placement'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_layout')
  );
*/

  $options = array(
    t('Default'),
    t('Thin')
  );

  $form['solstice']['solstice_home_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Home URL'),
    '#size' => 60,
    '#description' => t('This is the url for the link when the user clicks on the logo in the header.'),
    '#default_value' => theme_get_setting('solstice_home_url'),
    '#maxlength' => 128
  );

  $options = array(
    t('Inline list'),
    t('Dropdown')
  );

  $form['solstice']['toolbar_menu'] = array(
    '#type' => 'fieldset',
    '#title' => t('Toolbar menu'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE
  );

  $form['solstice']['toolbar_menu']['solstice_toolbar_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Toolbar layout'),
    '#description' => t('Choose the layout for the toolbar menu'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_toolbar_layout')
  );

  $options = array(
    t('Hide'),
    t('Show')
  );

  $form['solstice']['more_menu'] = array(
    '#type' => 'fieldset',
    '#title' => t('More menu item'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE
  );

  $form['solstice']['more_menu']['solstice_more_menu'] = array(
    '#type' => 'radios',
    '#title' => t('Display the "more" link'),
    '#description' => t('Display the "more" link in the main-menu.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_more_menu')
  );
/*
  $form['solstice']['more_menu']['solstice_more_menu_include_eclipse'] = array(
    '#type' => 'radios',
    '#title' => t('Display Eclipse links'),
    '#description' => t('Display default Eclipse links in more drop-down.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_more_menu_include_eclipse')
  );
*/
  $form['solstice']['solstice_full_width'] = array(
    '#type' => 'fieldset',
    '#title' => t('Full width layout'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $options = array(
    t('Use the full width layout on all pages except the listed pages.'),
    t('Use the full width layout on only the listed pages.')
  );

  $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard.
    Example paths are %blog for the blog page and %blog-wildcard for every personal blog.
    %front is the front page.", array(
    '%blog' => 'blog',
    '%blog-wildcard' => 'blog/*',
    '
      %front' => '<front>'
  ));

  $form['solstice']['solstice_full_width']['solstice_full_width'] = array(
    '#type' => 'radios',
    '#title' => t('Full width'),
    '#description' => t('This is useful for administrative pages, and in certain contexts.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_full_width')
  );

  $form['solstice']['solstice_full_width']['solstice_full_width_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_full_width_pages'),
    '#description' => $description
  );

  // Display Sidebar
/*
  $form['solstice']['solstice_sidebars'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display sidebars at the top'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $options = array(
    t('Display the sidebar at the top of all pages except the listed pages.'),
    t('Display the sidebar at the top only on the listed pages.')
  );

  $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard.
    Example paths are %blog for the blog page and %blog-wildcard for every personal blog.
    %front is the front page.", array(
    '%blog' => 'blog',
    '%blog-wildcard' => 'blog/*',
    '
      %front' => '<front>'
  ));

  $form['solstice']['solstice_sidebars']['solstice_sidebars_display_top'] = array(
    '#type' => 'radios',
    '#title' => t('Display'),
    '#description' => t('This is useful for administrative pages, and in certain contexts.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_sidebars_display_top')
  );

  $form['solstice']['solstice_sidebars']['solstice_sidebars_display_top_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_sidebars_display_top_pages'),
    '#description' => $description
  );
*/
  // Title Position
  $form['solstice']['solstice_title_position'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page title'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $options = array(
    t('Print title in default location except on the listed pages.'),
    t('Print title in default location only the listed pages.')
  );

  $form['solstice']['solstice_title_position']['solstice_title_position'] = array(
    '#type' => 'radios',
    '#title' => t('Title position'),
    '#description' => t('The default location is under "content_top" region. Sometimes you might need to print the title before that region.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_title_position')
  );

  $form['solstice']['solstice_title_position']['solstice_title_position_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_title_position_pages'),
    '#description' => $description
  );

  // Bug 499572 - [drupal] - Allow admin to hide page title for specific pages
  $options = array(
    t('Show page title on all pages except on the listed pages.'),
    t('Only show the page title on the listed pages.')
  );

  $form['solstice']['solstice_title_position']['solstice_title_display'] = array(
    '#type' => 'radios',
    '#title' => t('Display Title'),
    '#description' => t('The default location is under "content_top" region. Sometimes you might need to print the title before that region.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_title_display')
  );

  $form['solstice']['solstice_title_position']['solstice_title_display_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_title_display_pages'),
    '#description' => $description
  );

  // Call for action button.
  $form['solstice']['solstice_call_for_action'] = array(
    '#type' => 'fieldset',
    '#title' => t('Call for action button'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $form['solstice']['solstice_call_for_action']['solstice_call_for_action'] = array(
    '#type' => 'radios',
    '#title' => t('Enable the call for action button'),
    '#default_value' => theme_get_setting('solstice_call_for_action'),
    '#options' => array(
      t('Hide'),
      t('Show')
    )
  );

  $form['solstice']['solstice_call_for_action']['solstice_call_for_action_caption'] = array(
    '#type' => 'textfield',
    '#title' => t('Call for action caption'),
    '#size' => 60,
    '#default_value' => theme_get_setting('solstice_call_for_action_caption'),
    '#maxlength' => 128
  );

  $form['solstice']['solstice_call_for_action']['solstice_call_for_action_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Call for action url'),
    '#size' => 60,
    '#default_value' => theme_get_setting('solstice_call_for_action_url'),
    '#maxlength' => 128
  );

  $form['solstice']['solstice_call_for_action']['solstice_call_for_action_hide'] = array(
    '#type' => 'checkbox',
    '#title' => t("Hide when viewing the button's page"),
    '#default_value' => theme_get_setting('solstice_call_for_action_hide'),
    "#description" => "This will hide the button when viewing the page specified in the Call for action url field."
  );

  // Call for action button.
  $form['solstice']['solstice_fontpage'] = array(
    '#type' => 'fieldset',
    '#title' => t('Frontpage'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $default_value = 0;
  if (theme_get_setting('solstice_fontpage_layout')) {
    $default_value = theme_get_setting('solstice_fontpage_layout');
  }
  $form['solstice']['solstice_fontpage']['solstice_fontpage_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Choose homepage layout'),
    '#default_value' => $default_value,
    '#options' => array(
      t('2 columns on front page only (default)'),
      t('Do not use front page layout'),
      t('Use front page layout on specific pages')
    )
  );

  $form['solstice']['solstice_fontpage']['solstice_fontpage_layout_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Specific pages'),
    '#default_value' => theme_get_setting('solstice_fontpage_layout_pages'),
    '#description' => $description
  );

  // Thin Layout
  $form['solstice']['solstice_thin_layout'] = array(
    '#type' => 'fieldset',
    '#title' => t('Thin layout'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $options = array(
    t('Use thin header on all pages except on the listed pages.'),
    t('Use thin header on the listed pages only.')
  );

  $form['solstice']['solstice_thin_layout']['solstice_thin_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Thin layout'),
    '#description' => t('Hide menu and call for action and only display logo in the middle.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_thin_layout')
  );

  $form['solstice']['solstice_thin_layout']['solstice_thin_layout_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_thin_layout_pages'),
    '#description' => $description
  );
/*
  $options = array(
    t('Use minimalist thin header on all pages except on the listed pages.'),
    t('Use minimalist thin header on the listed pages only.')
  );

  $form['solstice']['solstice_thin_layout']['solstice_minimalist_thin_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Minimalist thin layout'),
    '#description' => t('This only works for pages already using the thin header. It remove the main menu and center align the logo.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_minimalist_thin_layout')
  );

  $form['solstice']['solstice_thin_layout']['solstice_minimalist_thin_layout_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_minimalist_thin_layout_pages'),
    '#description' => $description
  );
*/
  // Bug 499503 - [drupal] - Allow admin to hide the breadcrumbs on specific
  // pages
  $form['solstice']['solstice_breadcrumb_display'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display breadcrumb'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $options = array(
    t('Use breadcrumb on all pages except on the listed pages.'),
    t('Use breadcrumb on the listed pages only.')
  );

  $form['solstice']['solstice_breadcrumb_display']['solstice_breadcrumb_display'] = array(
    '#type' => 'radios',
    '#title' => t('Display breadcrumb'),
    '#description' => t('The breadcrumb might take too much space on certain page. This option allow you to disable it.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_breadcrumb_display')
  );

  $form['solstice']['solstice_breadcrumb_display']['solstice_breadcrumb_display_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_breadcrumb_display_pages'),
    '#description' => $description
  );

  // Bug 499502 - [drupal] - Allow admin to use a different footer on certain
  // pages
  $form['solstice']['solstice_footer_display'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page footer'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $options = array(
    t('Display footer on all pages except on the listed pages.'),
    t('Display footer on the listed pages only.')
  );

  $form['solstice']['solstice_footer_display']['solstice_footer_display'] = array(
    '#type' => 'radios',
    '#title' => t('Display footer'),
    '#description' => t('It might be useful to hide the footer for some pages, i.e, password reset page.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_footer_display')
  );

  $form['solstice']['solstice_footer_display']['solstice_footer_display_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_footer_display_pages'),
    '#description' => $description
  );

  $options = array(
    t('Display default footer on all pages except on the listed pages.'),
    t('Display default footer on the listed pages only.')
  );

  $form['solstice']['solstice_footer_display']['solstice_footer_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Minimalist footer'),
    '#description' => t('You might want to use a simple footer for some pages.'),
    '#options' => $options,
    '#default_value' => theme_get_setting('solstice_footer_layout')
  );

  $form['solstice']['solstice_footer_display']['solstice_footer_layout_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => theme_get_setting('solstice_footer_layout_pages'),
    '#description' => $description
  );
}
