You are here

function uc_termsofservice_admin_form in Ubercart Terms of Service 6

Same name and namespace in other branches
  1. 7 uc_termsofservice.module \uc_termsofservice_admin_form()

Settings form for checkout & cart panes.

2 calls to uc_termsofservice_admin_form()
uc_termsofservice_checkout_pane_callback in ./uc_termsofservice.module
Callback form for checkout pane.
uc_termsofservice_form_alter in ./uc_termsofservice.module
Implements hook_form_alter().

File

./uc_termsofservice.module, line 260
Ubercart Terms of Service.

Code

function uc_termsofservice_admin_form($type = NULL) {
  if ($type) {
    $form = array();

    // Required option only for checkout by the moment.
    if ($type == 'checkout') {
      $form['uc_termsofservice_' . $type . '_required'] = array(
        '#type' => 'checkbox',
        '#title' => t('ToS agreement is required'),
        '#default_value' => variable_get('uc_termsofservice_' . $type . '_required', 0),
        '#weight' => 1,
      );
    }
    $form['uc_termsofservice_' . $type . '_node'] = array(
      '#type' => 'textfield',
      '#title' => t('Terms of Service node'),
      '#description' => t('Enter the title of the node that contains your Terms of Service. Note that this node will be shown regardless of node access permissions.'),
      '#autocomplete_path' => 'uc_termsofservice/node/autocomplete',
      '#default_value' => variable_get('uc_termsofservice_' . $type . '_node', NULL),
      '#weight' => 0,
    );
    $form['uc_termsofservice_advanced_settings'] = array(
      '#type' => 'fieldset',
      '#title' => t('Advanced settings'),
      '#weight' => 2,
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['uc_termsofservice_advanced_settings']['uc_termsofservice_' . $type . '_ca'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable Conditional Actions'),
      '#description' => t('You can set the product classes in which the pane will be displayed with <a href="@url">conditional actions</a>', array(
        '@url' => url('admin/store/ca/uc_termsofservice_display_pane/edit/conditions'),
      )),
      '#default_value' => variable_get('uc_termsofservice_' . $type . '_ca', 0),
    );
    if (module_exists('modalframe')) {
      $form['uc_termsofservice_advanced_settings']['uc_termsofservice_' . $type . '_popup'] = array(
        '#type' => 'checkbox',
        '#title' => t('Open ToS in a popup modal window.'),
        '#default_value' => variable_get('uc_termsofservice_' . $type . '_popup', 0),
      );
      $form['uc_termsofservice_advanced_settings']['uc_termsofservice_' . $type . '_popup_width'] = array(
        '#type' => 'textfield',
        '#title' => t('Width of the popup window'),
        '#default_value' => variable_get('uc_termsofservice_' . $type . '_popup_width', NULL),
        '#size' => 4,
      );
      $form['uc_termsofservice_advanced_settings']['uc_termsofservice_' . $type . '_popup_height'] = array(
        '#type' => 'textfield',
        '#title' => t('Height of the popup window'),
        '#default_value' => variable_get('uc_termsofservice_' . $type . '_popup_height', NULL),
        '#size' => 4,
      );
    }
    return $form;
  }
}