You are here

function esign_field_widget_settings_form in E-Sign 7

Implements hook_field_widget_settings_form().

File

./esign.module, line 67
Defines all hooks and functions to manage the e-sign field.

Code

function esign_field_widget_settings_form($field, $instance) {
  $widget = $instance['widget'];
  $settings = esign_field_widget_info()['esign_signature_widget']['settings'];
  if (isset($widget['settings']['advanced_settings'])) {
    $settings = array_merge($settings, $widget['settings']['advanced_settings']);
  }
  $form = array();
  if ($widget['type'] == 'esign_signature_widget') {
    $form['advanced_settings'] = array(
      '#type' => 'fieldset',
      '#title' => t('Advanced Settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['advanced_settings']['dotSize'] = array(
      '#type' => 'textfield',
      '#title' => t('Dot Size'),
      '#default_value' => $settings['dotSize'],
      '#element_validate' => array(
        'element_validate_number',
      ),
      '#required' => TRUE,
      '#size' => 5,
      '#description' => t('Radius of a single dot.'),
    );
    $form['advanced_settings']['minWidth'] = array(
      '#type' => 'textfield',
      '#title' => t('Minimum Width'),
      '#default_value' => $settings['minWidth'],
      '#element_validate' => array(
        'element_validate_number',
      ),
      '#required' => TRUE,
      '#size' => 5,
      '#description' => t('Minimum width of a line'),
    );
    $form['advanced_settings']['maxWidth'] = array(
      '#type' => 'textfield',
      '#title' => t('Maximum Width'),
      '#default_value' => $settings['maxWidth'],
      '#element_validate' => array(
        'element_validate_number',
      ),
      '#required' => TRUE,
      '#size' => 5,
      '#description' => t('Maximum width of a line.'),
    );
    $form['advanced_settings']['backgroundColor'] = array(
      '#type' => 'textfield',
      '#title' => t('Background Color'),
      '#default_value' => $settings['backgroundColor'],
      '#required' => TRUE,
      '#size' => 15,
      '#description' => t('Color used to clear the background. Use the format rgba(#,#,#,#).'),
    );
    $form['advanced_settings']['penColor'] = array(
      '#type' => 'textfield',
      '#title' => t('Pen Color'),
      '#default_value' => $settings['penColor'],
      '#required' => TRUE,
      '#size' => 15,
      '#description' => t('Color used to draw the lines. Use the format rgba(#,#,#,#).'),
    );
    $form['advanced_settings']['velocityFilterWeight'] = array(
      '#type' => 'textfield',
      '#title' => t('Velocity Filter Weight'),
      '#default_value' => $settings['velocityFilterWeight'],
      '#element_validate' => array(
        'element_validate_number',
      ),
      '#required' => TRUE,
      '#size' => 5,
      '#description' => t('Weight used to modify new velocity based on the previous velocity.'),
    );
    $form['advanced_settings']['hide_name'] = array(
      '#type' => 'checkbox',
      '#title' => t('Hide Signer Name'),
      '#default_value' => $settings['hide_name'],
      '#description' => t('Hides the Signer Name field.'),
    );
    $form['advanced_settings']['hide_title'] = array(
      '#type' => 'checkbox',
      '#title' => t('Hide Signer Title'),
      '#default_value' => $settings['hide_title'],
      '#description' => t('Hides the Signer Title field.'),
    );
    $form['advanced_settings']['toDataURL'] = array(
      '#type' => 'select',
      '#title' => t('Signature File Format'),
      '#default_value' => $settings['toDataURL'],
      '#options' => array(
        '' => 'PNG',
        'image/jpeg' => 'JPEG',
        'image/svg+xml' => 'SVG',
      ),
      '#description' => t('The file format of the saved signature image.'),
    );
  }
  return $form;
}