You are here

function field_timer_field_instance_settings_form in Field Timer 7

Implements hook_field_instance_settings_form().

File

./field_timer.module, line 320
Main module file.

Code

function field_timer_field_instance_settings_form($field, $instance) {
  $settings_form = array();
  $settings = $instance['settings'];
  foreach ($instance['display'] as $display) {
    if ($display['type'] == 'field_timer_jquery_countdown' || $display['type'] == 'field_timer_jquery_countdown_led') {
      $settings_form['jquery-countdown'] = array(
        '#type' => 'fieldset',
        '#title' => t('jQuery Countdown options'),
        '#description' => t('This settings effect only on jQuery Countdown and jQuery Countdown LED formatters.'),
        '#collapsed' => TRUE,
        '#collapsible' => TRUE,
      );
      $token_description = module_exists('token') ? '<br />' . t('This field supports tokens.') : '';
      $settings_form['jquery-countdown']['expiryUrl'] = array(
        '#type' => 'textfield',
        '#title' => t('Expiry URL'),
        '#default_value' => $settings['jquery-countdown']['expiryUrl'],
        '#description' => t('A URL to load when the countdown reaches zero.!brSee !link for this parameter.!token_description', array(
          '!token_description' => $token_description,
          '!br' => '<br />',
          '!link' => l(t('documentation'), 'http://keith-wood.name/countdownRef.html', array(
            'fragment' => 'expiryUrl',
          )),
        )),
      );
      $settings_form['jquery-countdown']['expiryText'] = array(
        '#type' => 'textarea',
        '#title' => t('Expiry text'),
        '#default_value' => $settings['jquery-countdown']['expiryText'],
        '#description' => t('A message to display when the countdown reaches zero.!brSee !link for this parameter.!token_description', array(
          '!token_description' => $token_description,
          '!br' => '<br />',
          '!link' => l(t('documentation'), 'http://keith-wood.name/countdownRef.html', array(
            'fragment' => 'expiryText',
          )),
        )),
      );
      $settings_form['jquery-countdown']['description'] = array(
        '#type' => 'textarea',
        '#title' => t('Description'),
        '#default_value' => $settings['jquery-countdown']['description'],
        '#description' => t('The descriptive text shown below the countdown timer.!brSee !link for this parameter.!token_description', array(
          '!token_description' => $token_description,
          '!br' => '<br />',
          '!link' => l(t('documentation'), 'http://keith-wood.name/countdownRef.html', array(
            'fragment' => 'description',
          )),
        )),
      );
      if (module_exists('token')) {
        $settings_form['jquery-countdown']['token'] = array(
          '#theme' => 'token_tree',
          '#token_types' => array(
            $instance['entity_type'],
          ),
          '#global_types' => TRUE,
          '#click_insert' => FALSE,
        );
      }
      break;
    }
  }
  return $settings_form;
}