You are here

function nicemessages_settings_form in Nice messages 7.2

Same name and namespace in other branches
  1. 7 nicemessages.module \nicemessages_settings_form()

Module settings form.

1 string reference to 'nicemessages_settings_form'
nicemessages_menu in ./nicemessages.module
Implements hook_menu().

File

./nicemessages.module, line 178
Nicemessages module

Code

function nicemessages_settings_form() {
  $form['global'] = array(
    '#type' => 'fieldset',
    '#title' => t('Global settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['global']['nicemessages_default_state'] = array(
    '#type' => 'radios',
    '#title' => t('Activation method'),
    '#default_value' => variable_get('nicemessages_default_state', 'on'),
    '#options' => array(
      'on' => t('On'),
      'off' => t('Off'),
      'user' => t('User'),
    ),
    '#description' => t('' . 'The settings <strong>On</strong> (1) and <strong>Off</strong> (2) ' . 'are both global settings affecting all users including Anonoumus user, ' . 'ignoring any user settings on user account profile forms.<br /> ' . 'The setting <strong>User</strong> (3) lets users ' . '(but only of user roles with "toggle nicemessages" permission!) ' . 'toggle Nicemessages by selecting On/Off on their user account profile forms.'),
  );
  $form['global']['nicemessages_position'] = array(
    '#type' => 'select',
    '#title' => t('Message popup screen position'),
    '#default_value' => variable_get('nicemessages_position', 'top-right'),
    '#options' => array(
      'top-left' => t('top left'),
      'center' => t('top center'),
      'top-right' => t('top right'),
      'bottom-left' => t('bottom left'),
      'bottom-right' => t('bottom right'),
    ),
    '#description' => t('' . 'Choose where the popup messages should be displayed in the browser port view.<br /> ' . 'The appending/prepending of multiple messages will automatically change regarding to your choosen position.'),
  );
  $form['global']['nicemessages_style'] = array(
    '#type' => 'select',
    '#title' => t('Nice messages styles (colors)'),
    '#default_value' => variable_get('nicemessages_style', 'nicemessages_jgrowl.css'),
    '#options' => array(
      'nicemessages_jgrowl.css' => t('jGrowl'),
      'nicemessages_drupal.css' => t('Drupal'),
      'nicemessages_facebook.css' => t('Facebook'),
    ),
    '#description' => t('' . 'In the moment Nicemessages supports 3 styles:<br />' . '<ol>' . '<li><em><strong>jGrowl</strong> - ' . 'default jGrowl popup style based on the popup script. (black, no icons) ' . 'for all message types.</em></li>' . '<li><em><strong>Drupal</strong> - ' . 'Drupals default 3 system message type icons & colors.</em></li>' . '<li><em><strong>Facebook</strong> - ' . 'imitating the light-grey-blue rounded popup style of Facebook statuses ' . 'for all message types. Errors get red borders.</em></li>' . '</ol>' . 'Additional styles can be added by copying and modifying css files in module ' . '/css folder and changing this description and selection form.'),
  );
  $form['global']['nicemessages_shadows'] = array(
    '#type' => 'checkbox',
    '#title' => t('Nice messages box shadows'),
    '#default_value' => variable_get('nicemessages_shadows', 1),
    '#options' => array(
      0 => FALSE,
      1 => TRUE,
    ),
    '#description' => t('' . 'Accentuation of the popup boxes by emphasing with light surrounding shadows.'),
  );
  $form['global']['nicemessages_visibility'] = array(
    '#type' => 'fieldset',
    '#title' => t('Pages'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['global']['nicemessages_visibility']['nicemessages_pages'] = array(
    '#type' => 'radios',
    '#title' => t('Show nicemessages on specific pages'),
    '#default_value' => variable_get('nicemessages_pages', 0),
    '#options' => array(
      0 => t('All pages except those listed'),
      1 => t('Only the listed pages'),
    ),
  );
  $form['global']['nicemessages_visibility']['nicemessages_paths'] = array(
    '#type' => 'textarea',
    '#default_value' => variable_get('nicemessages_paths', 'admin/*'),
    '#description' => t("" . "Specify pages by using their paths. Enter one path per line. " . "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>',
    )),
  );
  foreach (array(
    'status',
    'warning',
    'error',
  ) as $type) {
    $type_prefix = 'nicemessages_' . $type . '_';
    $form[$type] = array(
      '#type' => 'fieldset',
      '#title' => t('@type messages', array(
        '@type' => $type,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form[$type][$type_prefix . 'life'] = array(
      '#type' => 'textfield',
      '#title' => t('How long should the message be visible?'),
      '#default_value' => variable_get($type_prefix . 'life', '6'),
      '#size' => 10,
      '#maxlength' => 10,
      '#required' => FALSE,
      '#field_suffix' => 'seconds',
      '#description' => t('Enter 0 for sticky messages'),
    );
    $form[$type][$type_prefix . 'glue'] = array(
      '#type' => 'select',
      '#title' => t('Should new messages be prepended or appended to the list?'),
      '#default_value' => variable_get($type_prefix . 'glue', 'after'),
      '#options' => array(
        'before' => 'prepended',
        'after' => 'appended',
      ),
    );
    $form[$type][$type_prefix . 'speed'] = array(
      '#type' => 'select',
      '#title' => t('Animation speed'),
      '#default_value' => variable_get($type_prefix . 'speed', 'slow'),
      '#options' => array(
        'slow' => 'slow',
        'normal' => 'normal',
        'fast' => 'fast',
      ),
    );
  }
  return system_settings_form($form);
}