You are here

function clipboardjs_field_formatter_settings_form in Clipboard.js 7

Implements hook_field_formatter_settings_form().

File

./clipboardjs.module, line 89
Integrates the Clipboard.js library with Drupal.

Code

function clipboardjs_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  switch ($display['type']) {
    case 'text_clipboardjs':
      $element['alert_style'] = array(
        '#title' => t('Alert Style'),
        '#type' => 'radios',
        '#options' => array(
          'alert' => t('Alert'),
          'tooltip' => t('Tooltip'),
        ),
        '#default_value' => $settings['alert_style'],
        '#required' => TRUE,
      );
      $element['alert_text'] = array(
        '#title' => t('Alert Text'),
        '#type' => 'textfield',
        '#default_value' => $settings['alert_text'],
        '#required' => TRUE,
      );
      $element['button_label'] = array(
        '#title' => t('Button Label'),
        '#type' => 'textfield',
        '#default_value' => $settings['button_label'],
        '#required' => TRUE,
      );
      break;
  }
  return $element;
}