You are here

function zopim_admin_settings_form in Zopim Live Chat 6.2

Same name in this branch
  1. 6.2 includes/zopim-account.admin.inc \zopim_admin_settings_form()
  2. 6.2 includes/zopim-customize.admin.inc \zopim_admin_settings_form()
  3. 6.2 includes/zopim-visibility.admin.inc \zopim_admin_settings_form()
Same name and namespace in other branches
  1. 6 zopim.admin.inc \zopim_admin_settings_form()
  2. 7 zopim.admin.inc \zopim_admin_settings_form()

Implementation of hook_admin_settings() for configuring the module

1 string reference to 'zopim_admin_settings_form'
zopim_menu in ./zopim.module

File

includes/zopim-customize.admin.inc, line 11
Administrative page callbacks for the zopim module.

Code

function zopim_admin_settings_form(&$form_state) {
  $settings = zopim_get_settings();
  $account_details = zopim_get_account_details();

  // Add Farbtastic color picker and ctools dependent js.
  $form['js']['#after_build'] = array(
    'zopim_admin_settings_form_load_js',
  );

  // General Settings
  $form['widget'] = array(
    '#type' => 'fieldset',
    '#title' => t('General'),
    '#collapsible' => FALSE,
    '#tree' => TRUE,
  );
  $form['widget']['language'] = array(
    '#type' => 'select',
    '#title' => t('Language'),
    '#options' => _zopim_get_languages(),
    '#default_value' => $settings['widget']['language'],
  );
  $form['widget']['position'] = array(
    '#type' => 'select',
    '#title' => t('Position'),
    '#options' => array(
      'br' => t('Bottom Right'),
      'bl' => t('Bottom Left'),
    ),
    '#default_value' => $settings['widget']['position'],
  );
  $form['widget']['use_user_info'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Logged in Username / Email'),
    '#description' => t('This will use the visitors Username and Email address if they are logged into this site.'),
    '#default_value' => $settings['widget']['use_user_info'],
  );
  $form['widget']['hide_when_offline'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide chat bar when offline'),
    '#description' => t('This prevents visitors from sending you offline messages.'),
    '#default_value' => $settings['widget']['hide_when_offline'],
  );

  // Theming
  $form['theming'] = array(
    '#type' => 'fieldset',
    '#title' => t('Color and Theme'),
    '#collapsible' => FALSE,
    '#tree' => TRUE,
  );
  $form['theming']['color'] = array(
    '#type' => 'textfield',
    '#title' => t('Color'),
    '#description' => $account_details->color_customization_enabled !== 1 ? t('Sorry, your plan does not allow for color customization. Please upgrade to enjoy choice of color!') : t('Sets the color for the chat bubble.'),
    '#default_value' => $settings['theming']['color'],
    '#suffix' => '<div id="colorpicker"></div>',
    '#size' => 10,
    '#disabled' => $account_details->color_customization_enabled !== 1,
  );
  $form['theming']['theme'] = array(
    '#type' => 'select',
    '#title' => t('Select a Theme'),
    '#description' => $account_details->widget_customization_enabled !== 1 ? t('Sorry, your plan does not allow for theme customization. Please upgrade to enjoy choice of themes!') : t('View the chat panel for changes.'),
    '#options' => zopim_get_themes(),
    '#default_value' => $settings['theming']['theme'],
    '#disabled' => $account_details->widget_customization_enabled !== 1,
  );

  // Help Bubble
  $form['help_bubble'] = array(
    '#type' => 'fieldset',
    '#title' => t('Help Bubble'),
    '#collapsible' => FALSE,
    '#tree' => TRUE,
  );
  $form['help_bubble']['display'] = array(
    '#type' => 'select',
    '#title' => t('Display Help Bubble'),
    '#options' => array(
      'default' => t('Let user decide'),
      'show' => t('Always show'),
      'hide' => t('Always hide'),
    ),
    '#default_value' => $settings['help_bubble']['display'],
  );
  $form['help_bubble']['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Help Bubble Title'),
    '#description' => t('Entice your visitors with this friendly chat bubble title!'),
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-help-bubble-display' => array(
        'default',
        'show',
      ),
    ),
    '#default_value' => $settings['help_bubble']['title'],
  );
  $form['help_bubble']['message'] = array(
    '#type' => 'textfield',
    '#title' => t('Help Bubble Message'),
    '#description' => t('Welcome your visitors and encourage them to talk with you.'),
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-help-bubble-display' => array(
        'default',
        'show',
      ),
    ),
    '#default_value' => $settings['help_bubble']['message'],
  );

  // Greeting Messages
  $form['greeting_messages'] = array(
    '#type' => 'fieldset',
    '#title' => t('Greeting Message'),
    '#collapsible' => FALSE,
    '#tree' => TRUE,
  );
  $form['greeting_messages']['enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Greetings'),
    '#description' => t('This prevents visitors from sending you offline messages.'),
    '#default_value' => $settings['greeting_messages']['enabled'],
  );
  $form['greeting_messages']['chatbar'] = array(
    '#type' => 'fieldset',
    '#title' => t('Chatbar Messages'),
    '#collapsible' => FALSE,
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-use-greetings' => array(
        '1',
      ),
    ),
    '#input' => TRUE,
    '#id' => 'zopim-greetings-chatbar',
    '#prefix' => '<div id="zopim-greetings-chatbar-wrapper">',
    '#suffix' => '</div>',
  );
  $form['greeting_messages']['chatbar']['online'] = array(
    '#type' => 'textfield',
    '#title' => t('Online'),
    '#maxlength' => 26,
    '#description' => t('Maximum length of 26 characters.'),
    '#default_value' => $settings['greeting_messages']['chatbar']['online'],
  );
  $form['greeting_messages']['chatbar']['away'] = array(
    '#type' => 'textfield',
    '#title' => t('Away'),
    '#maxlength' => 26,
    '#description' => t('Maximum length of 26 characters.'),
    '#default_value' => $settings['greeting_messages']['chatbar']['away'],
  );
  $form['greeting_messages']['chatbar']['offline'] = array(
    '#type' => 'textfield',
    '#title' => t('Offline'),
    '#maxlength' => 26,
    '#description' => t('Maximum length of 26 characters.'),
    '#default_value' => $settings['greeting_messages']['chatbar']['offline'],
  );
  $form['greeting_messages']['panel'] = array(
    '#type' => 'fieldset',
    '#title' => t('Panel Messages'),
    '#collapsible' => FALSE,
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-use-greetings' => array(
        '1',
      ),
    ),
    '#input' => TRUE,
    '#id' => 'zopim-greetings-panel',
    '#prefix' => '<div id="zopim-greetings-panel-wrapper">',
    '#suffix' => '</div>',
  );
  $form['greeting_messages']['panel']['online'] = array(
    '#type' => 'textfield',
    '#title' => t('Online'),
    '#maxlength' => 26,
    '#description' => t('Maximum length of 140 characters.'),
    '#default_value' => $settings['greeting_messages']['panel']['online'],
  );
  $form['greeting_messages']['panel']['away'] = array(
    '#type' => 'textfield',
    '#title' => t('Away'),
    '#maxlength' => 26,
    '#description' => t('Maximum length of 140 characters.'),
    '#default_value' => $settings['greeting_messages']['panel']['away'],
  );
  $form['greeting_messages']['panel']['offline'] = array(
    '#type' => 'textfield',
    '#title' => t('Offline'),
    '#maxlength' => 26,
    '#description' => t('Maximum length of 140 characters.'),
    '#default_value' => $settings['greeting_messages']['panel']['offline'],
  );
  $form['#submit'][] = 'zopim_set_settings';
  return system_settings_form($form);
}