You are here

function tweetbutton_field_instance_settings_form in Tweet Button 7.2

Implements hook_field_instance_settings_form().

File

./tweetbutton.module, line 43

Code

function tweetbutton_field_instance_settings_form($field, $instance) {
  $settings = $instance['settings'];
  $form = array();
  $form['tweet_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Tweet text'),
    '#default_value' => isset($settings['tweet_text']) ? $settings['tweet_text'] : variable_get('tweetbutton_tweet_text'),
  );
  $form['author_twitter'] = array(
    '#type' => 'textfield',
    '#title' => t('Author twitter account'),
    '#default_value' => isset($settings['author_twitter']) ? $settings['author_twitter'] : variable_get('tweetbutton_account'),
    '#description' => t('This user will be @mentioned in the suggested'),
  );
  if ($instance['entity_type'] == 'taxonomy_term') {
    $token_type = 'term';
  }
  else {
    $token_type = $instance['entity_type'];
  }
  $form['tokens'] = array(
    '#token_types' => array(
      $token_type,
    ),
    '#theme' => 'token_tree',
  );
  return $form;
}