You are here

function livechat_admin_settings_form in LiveChat 7

Settings form.

1 string reference to 'livechat_admin_settings_form'
livechat_menu in ./livechat.module
Implements hook_menu().

File

./livechat.admin.inc, line 11
Administration pages for the LiveChat module.

Code

function livechat_admin_settings_form($form_state) {

  // Warn user if no license has been installed.
  if (!livechat_is_installed()) {
    $license_warning = t('A LiveChat license has not been installed. You can do
       so on the <a href="!url">@install</a> tab.', array(
      '!url' => url('admin/config/services/livechat/install'),
      '@install' => t('Install'),
    ));
    drupal_set_message($license_warning, 'warning', FALSE);
  }

  // Warn user if no role has the "use livechat" permission.
  $use_livechat_roles = user_roles(FALSE, 'use livechat');
  if (empty($use_livechat_roles)) {
    $permissions_warning = t('No roles have been given access to the LiveChat
       widget. See <a href="!url">the module\'s permissions</a>.', array(
      '!url' => url('admin/people/permissions', array(
        'fragment' => 'module-livechat',
        'query' => array(
          'destination' => current_path(),
        ),
      )),
    ));
    drupal_set_message($permissions_warning, 'warning', FALSE);
  }
  $form['path'] = array(
    '#type' => 'fieldset',
    '#title' => t('Visibility'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['path']['livechat_visibility'] = array(
    '#type' => 'radios',
    '#title' => t('Show LiveChat on'),
    '#options' => array(
      LIVECHAT_VISIBILITY_NOTLISTED => t('All pages except those listed'),
      LIVECHAT_VISIBILITY_LISTED => t('Only the listed pages'),
    ),
    '#default_value' => variable_get('livechat_visibility', LIVECHAT_VISIBILITY_NOTLISTED),
  );
  $form['path']['livechat_pages'] = array(
    '#type' => 'textarea',
    '#default_value' => variable_get('livechat_pages', LIVECHAT_VISIBILITY_DEFAULT_PAGES),
    '#description' => t("Specify pages by using their paths. Enter one path per\n      line. The '*' character is a wildcard. Example paths are %blog for the blog\n      page and %blog-wildcard for every personal blog. %front is the\n      front page.", array(
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
    )),
  );
  $form['path']['livechat_exclude_system_paths'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable LiveChat on common system paths (recommended)'),
    '#description' => t('LiveChat will not trigger on the following paths: %paths', array(
      '%paths' => str_replace("\n", ', ', LIVECHAT_VISIBILITY_SYSTEM_PATHS),
    )),
    '#default_value' => variable_get('livechat_exclude_system_paths', 1),
  );
  $form['livechat_group'] = array(
    '#type' => 'textfield',
    '#title' => 'Group Id',
    '#description' => 'If you are using LiveChat on more than one website,
       enter the id of the website here',
    '#default_value' => variable_get('livechat_group', ''),
  );
  $form['livechat_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable LiveChat'),
    '#description' => t('Uncheck this box to disable LiveChat.'),
    '#default_value' => variable_get('livechat_enabled', TRUE),
  );
  return system_settings_form($form);
}