You are here

function site_status_message_settings in Site Status Message 7

Site Status Message settings configuration form.

Parameters

array $form: The form array.

array $form_state: The form_state array.

Return value

array System settings form.

1 string reference to 'site_status_message_settings'
site_status_message_menu in ./site_status_message.module
Implements hook_page_menu().

File

./site_status_message.admin.inc, line 22
Site Status Message admin page.

Code

function site_status_message_settings(array $form, array &$form_state) {
  $form['site_status'] = array(
    '#type' => 'fieldset',
    '#title' => 'Site Status Message',
    'site_status_message_message' => array(
      '#type' => 'textfield',
      '#maxlength' => 256,
      '#title' => t('Status message'),
      '#default_value' => variable_get('site_status_message_message', NULL),
      '#description' => t('A message to display at the top of each page.'),
      '#weight' => 0,
    ),
    'site_status_message_showlink' => array(
      '#type' => 'checkbox',
      '#title' => t('Read more page'),
      '#default_value' => variable_get('site_status_message_showlink', ''),
      '#description' => t('Optional "Read More" link to provide the viewer with more information.'),
      '#weight' => 10,
    ),
    'site_status_message_link' => array(
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 256,
      '#title' => t('More information page'),
      '#default_value' => variable_get('site_status_message_link', NULL) ? drupal_get_path_alias(variable_get('site_status_message_link', NULL)) : NULL,
      '#description' => t('An optional internal link to show more information about the status message.'),
      '#field_prefix' => url(NULL, array(
        'absolute' => TRUE,
      )),
      '#weight' => 20,
      '#element_validate' => array(
        '_site_status_message_link_validate',
      ),
      '#states' => array(
        'visible' => array(
          ':input[name="site_status_message_showlink"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    ),
    'site_status_message_readmore' => array(
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 128,
      '#title' => t('More information link text'),
      '#default_value' => variable_get('site_status_message_readmore', 'Read more'),
      '#description' => t('The text to display on the "More Information" link.'),
      '#weight' => 30,
      '#states' => array(
        'visible' => array(
          ':input[name="site_status_message_showlink"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    ),
  );

  // Add the token tree UI.
  if (module_exists('token')) {
    $form['site_status']['site_status_message_message']['#description'] .= ' ' . t('This field supports tokens.') . ' ' . theme('token_tree_link');
  }
  $form['display'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display options'),
    'site_status_message_display_options' => array(
      '#type' => 'radios',
      '#title' => t('Where on the site should the message be displayed'),
      '#options' => _site_status_message_get_display_options(),
      '#default_value' => variable_get('site_status_message_display_options', 'public'),
    ),
    '#weight' => 40,
  );
  return system_settings_form($form);
}