You are here

public function TweetbuttonItem::settingsForm in Tweet Button 8

File

lib/Drupal/tweetbutton/Plugin/Field/FieldType/TweetbuttonItem.php, line 54
Contains \Drupal\tweetbutton\Plugin\Field\FieldType\TweetbuttonItem.

Class

TweetbuttonItem
Plugin implementation of the 'tweetbutton' field type.

Namespace

Drupal\tweetbutton\Plugin\Field\FieldType

Code

public function settingsForm(array $form, array &$form_state, $has_data) {
  $element = array();
  $config = \Drupal::config('tweetbutton.settings');
  $settings = $this
    ->getFieldDefinition()
    ->getField()
    ->getSettings();
  $element['tweet_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Tweet text'),
    '#default_value' => isset($settings['tweet_text']) ? $settings['tweet_text'] : $config
      ->get('tweetbutton_tweet_text'),
  );
  $element['author_twitter'] = array(
    '#type' => 'textfield',
    '#title' => t('Author twitter account'),
    '#default_value' => isset($settings['author_twitter']) ? $settings['author_twitter'] : $config
      ->get('tweetbutton_account'),
    '#description' => t('This user will be @mentioned in the suggested'),
  );
  return $element;
}