function better_messages_admin_skin_form in Better Messages 7.2
Form builder for Better Messages skin settings form.
Parameters
$skin:
- If $skin in null, consider this as an add form.
Return value
An array representing the form definition.
See also
better_messages_admin_skin_form_submit()
1 string reference to 'better_messages_admin_skin_form'
- better_messages_menu in ./
better_messages.module - Implements hook_menu().
File
- ./
better_messages.admin.inc, line 111
Code
function better_messages_admin_skin_form($form, &$form_state, $op, $skin = null) {
if ($skin) {
$settings = _better_messages_get_settings($skin);
}
$form = array();
$form['name'] = array(
'#title' => t('Title'),
'#type' => 'textfield',
'#default_value' => $skin && $op != 'clone' ? $settings[$skin]['admin']['title'] : '',
'#description' => t('The human-readable name of this skin. It is recommended that this name begin with a capital letter and contain only letters, numbers, and spaces. This name must be unique.'),
'#required' => TRUE,
'#size' => 30,
);
$form['machine_name'] = array(
'#type' => 'machine_name',
'#default_value' => $skin && $op != 'clone' ? $skin : '',
'#maxlength' => 128,
'#disabled' => '',
'#machine_name' => array(
'exists' => '_better_messages_get_settings',
),
'#description' => t('A unique machine-readable name for this skin. It must only contain lowercase letters, numbers, and underscores'),
);
$form['css_path'] = array(
'#title' => t('CSS stylesheet path'),
'#type' => 'textfield',
'#default_value' => $skin ? $settings[$skin]['admin']['css'] : '',
'#description' => t("Path of your CSS stylesheet relative to Drupal's root directory.<br />Example: <abbr>sites/all/themes/zen/better_messages/skin.css</abbr>"),
'#required' => TRUE,
'#size' => 70,
);
$form['settings'] = array(
'#type' => 'vertical_tabs',
'#weight' => 1,
'#title' => t('Messages settings'),
'#attached' => array(
'js' => array(
drupal_get_path('module', 'better_messages') . '/better_messages.admin.js',
),
'css' => array(
drupal_get_path('module', 'better_messages') . '/better_messages.admin.css',
),
),
);
$form['settings']['position'] = array(
'#type' => 'fieldset',
'#title' => t('Messages positions and basic properties'),
'#weight' => 1,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['settings']['position']['pos_xy'] = array(
'#type' => 'item',
'#title' => t('Position of Better Messages'),
);
$form['settings']['position']['pos_xy']['pos_x'] = array(
'#type' => 'select',
'#title' => t('X-axis') . ':',
'#default_value' => $skin ? $settings[$skin]['placement']['pos_x'] : '',
'#options' => array(
'c' => t('Center'),
'r' => t('Right'),
'l' => t('Left'),
),
);
$form['settings']['position']['pos_xy']['pos_y'] = array(
'#type' => 'select',
'#title' => t('Y-axis') . ':',
'#default_value' => $skin ? $settings[$skin]['placement']['pos_y'] : '',
'#options' => array(
'c' => t('Center'),
't' => t('Top'),
'b' => t('Bottom'),
),
'#suffix' => '<div class="better-messages-clear"></div>',
);
$form['settings']['position']['space_x'] = array(
'#type' => 'textfield',
'#title' => t('X-axis spacing'),
'#description' => t('Inactive when position is set to "center".<br />In pixels. Example: 10'),
'#default_value' => $skin ? $settings[$skin]['placement']['space_x'] : '',
'#size' => 15,
'#maxlength' => 3,
'#required' => TRUE,
);
$form['settings']['position']['space_y'] = array(
'#type' => 'textfield',
'#title' => t('Y-axis spacing'),
'#description' => t('Inactive when position is set to "center".<br />In pixels. Example: 10'),
'#default_value' => $skin ? $settings[$skin]['placement']['space_y'] : '',
'#size' => 15,
'#maxlength' => 3,
'#required' => TRUE,
);
$form['settings']['position']['width'] = array(
'#type' => 'textfield',
'#title' => t('Width of Better Messages'),
'#description' => t('Width in pixels. Example: 400px<br />Or percentage. Example: 100%'),
'#default_value' => $skin ? $settings[$skin]['placement']['width'] : '',
'#size' => 15,
'#maxlength' => 6,
'#required' => TRUE,
);
$form['settings']['position']['fixed'] = array(
'#type' => 'checkbox',
'#default_value' => $skin ? $settings[$skin]['placement']['fixed'] : '',
'#title' => t('Keep Better Messages position fixed while scrolling.'),
);
$form['settings']['animation'] = array(
'#type' => 'fieldset',
'#title' => t('Messages animation settings'),
'#weight' => 2,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['settings']['animation']['popin'] = array(
'#type' => 'fieldset',
'#title' => t('Pop-in (show) settings'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['animation']['popin']['popin_effect'] = array(
'#type' => 'select',
'#title' => t('Pop-in (show) message box effect'),
'#default_value' => $skin ? $settings[$skin]['animation']['popin']['effect'] : '',
'#options' => array(
'fadeIn' => t('Fade in'),
'slideDown' => t('Slide down'),
),
);
$form['settings']['animation']['popin']['popin_easing'] = array(
'#type' => 'textfield',
'#title' => t('Easing effect when poping in (showing) the message box'),
'#description' => t('Refer to <a href="@link">jQuery UI easing effects</a> for cool easing effects.', array(
'@link' => 'http://jqueryui.com/demos/effect/easing.html',
)),
'#default_value' => $skin ? $settings[$skin]['animation']['popin']['easing'] : '',
'#size' => 15,
'#maxlength' => 20,
);
$form['settings']['animation']['popin']['popin_duration'] = array(
'#type' => 'textfield',
'#title' => t('Duration of (show) effect'),
'#description' => t('A string representing one of the three predefined speeds ("slow", "normal", or "fast").<br />Or the number of milliseconds to run the animation (e.g. 1000).'),
'#default_value' => $skin ? $settings[$skin]['animation']['popin']['duration'] : '',
'#size' => 15,
'#maxlength' => 20,
);
$form['settings']['animation']['popin']['open_delay'] = array(
'#type' => 'textfield',
'#title' => t('Number of seconds to delay Better Messages after the page has loaded'),
'#description' => t('0 for none. You can set it as 0.25 for quarter second.'),
'#default_value' => $skin ? $settings[$skin]['animation']['popin']['opendelay'] : '',
'#size' => 15,
'#maxlength' => 20,
);
$form['settings']['animation']['popout'] = array(
'#type' => 'fieldset',
'#title' => t('Pop-out (close) settings'),
'#weight' => 1,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['animation']['popout']['popout_effect'] = array(
'#type' => 'select',
'#title' => t('Pop-out (close) message box effect'),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['effect'] : '',
'#options' => array(
'fadeIn' => t('Fade out'),
'slideUp' => t('Slide Up'),
),
);
$form['settings']['animation']['popout']['popout_easing'] = array(
'#type' => 'textfield',
'#title' => t('Easing effect when poping out (closing) the message box'),
'#description' => t('Refer to <a href="@link">jQuery UI easing effects</a> for cool easing effects.', array(
'@link' => 'http://jqueryui.com/demos/effect/easing.html',
)),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['easing'] : '',
'#size' => 15,
'#maxlength' => 20,
);
$form['settings']['animation']['popout']['popout_duration'] = array(
'#type' => 'textfield',
'#title' => t('Duration of (close) effect'),
'#description' => t('A string representing one of the three predefined speeds ("slow", "normal", or "fast").<br />Or the number of milliseconds to run the animation (e.g. 1000).'),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['duration'] : '',
'#size' => 20,
'#maxlength' => 20,
);
$form['settings']['animation']['autoclose'] = array(
'#type' => 'fieldset',
'#title' => t('Auto-close settings'),
'#weight' => 2,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['animation']['autoclose']['autoclose_seconds'] = array(
'#type' => 'textfield',
'#title' => t('Number of seconds to auto-close Better Messages after the page has loaded'),
'#description' => t('0 for never. You can set it as 0.25 for quarter second.'),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['autoclose']['seconds'] : '',
'#size' => 20,
'#maxlength' => 20,
);
$form['settings']['animation']['autoclose']['disable_autoclose_error'] = array(
'#type' => 'checkbox',
'#title' => t('Disable auto-close if Better Messages includes an error message'),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['autoclose']['disable_autoclose_error'] : '',
);
$form['settings']['animation']['autoclose']['disable_autoclose_hover'] = array(
'#type' => 'checkbox',
'#title' => t('Stop auto-close timer on hover'),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['autoclose']['disable_autoclose_hover'] : '',
);
$form['settings']['animation']['autoclose']['show_countdown'] = array(
'#type' => 'checkbox',
'#title' => t('Show countdown timer'),
'#default_value' => $skin ? $settings[$skin]['animation']['popout']['autoclose']['show_countdown'] : '',
);
$form['settings']['jquery_ui'] = array(
'#type' => 'fieldset',
'#title' => t('jQuery UI enhancements'),
'#weight' => 3,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['jquery_ui']['draggable'] = array(
'#type' => 'checkbox',
'#title' => t('Make Better Messages draggable'),
'#default_value' => $skin ? $settings[$skin]['jquery_ui']['draggable'] : '',
);
$visibility_options = array(
0 => t('All pages except those listed'),
1 => t('Only the listed pages'),
);
$visibility_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>',
));
$php_access = user_access('use PHP for settings');
if (module_exists('php') && $php_access) {
$visibility_options += array(
2 => t('Pages on which this PHP code returns <code>TRUE</code> (experts only)'),
);
$visibility_description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array(
'%php' => '<?php ?>',
));
}
$form['settings']['visibility_fieldset'] = array(
'#type' => 'fieldset',
'#weight' => 4,
'#title' => t('Better Messages visibility'),
'#collapsible' => FALSE,
);
$form['settings']['visibility_fieldset']['visibility'] = array(
'#type' => 'radios',
'#title' => t('Show Better Messages on specific pages'),
'#options' => $visibility_options,
'#default_value' => $skin ? $settings[$skin]['admin']['visibility']['visibility'] : '',
);
$form['settings']['visibility_fieldset']['pages'] = array(
'#type' => 'textarea',
'#default_value' => $skin ? $settings[$skin]['admin']['visibility']['pages'] : '',
'#description' => $visibility_description,
);
$form['actions'] = array(
'#tree' => FALSE,
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['#theme'] = 'system_settings_form';
return $form;
}