You are here

public function TwitterBlockBase::blockForm in Twitter Embed 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/TwitterBlockBase.php, line 68

Class

TwitterBlockBase
TwitterBlockBase class.

Namespace

Drupal\twitter_embed\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['username'] = [
    '#type' => 'textfield',
    '#title' => t('Username'),
    '#default_value' => $this->configuration['username'],
    '#required' => TRUE,
    '#field_prefix' => '@',
    '#maxlength' => TwitterWidgetInterface::USERNAME_MAX_LENGTH,
    '#size' => TwitterWidgetInterface::USERNAME_MAX_LENGTH,
  ];
  $settingsForm = $this->twitterWidget
    ->getSettingsForm($this->configuration);

  // Append javascript states.
  $selector = 'settings';
  $settingsFormWithStates = $this->twitterWidget
    ->setSettingsFormStates($settingsForm, $selector);
  return $form + $settingsFormWithStates;
}