public function TwitterPostBlock::blockForm in Social Feed 8
Returns the configuration form elements specific to this block plugin.
Blocks that need to add form elements to the normal block configuration form should implement this method.
Parameters
array $form: The form definition array for the block configuration form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The renderable form array representing the entire configuration form.
Overrides SocialBlockBase::blockForm
File
- src/
Plugin/ Block/ TwitterPostBlock.php, line 71
Class
- TwitterPostBlock
- Provides a 'TwitterPostBlock' block.
Namespace
Drupal\socialfeed\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$form = parent::blockForm($form, $form_state);
$form['overrides']['consumer_key'] = [
'#type' => 'textfield',
'#title' => $this
->t('Twitter Consumer Key'),
'#default_value' => $this
->defaultSettingValue('consumer_key'),
'#size' => 60,
'#maxlength' => 100,
'#required' => TRUE,
];
$form['overrides']['consumer_secret'] = [
'#type' => 'textfield',
'#title' => $this
->t('Twitter Consumer Secret'),
'#default_value' => $this
->defaultSettingValue('consumer_secret'),
'#size' => 60,
'#maxlength' => 100,
'#required' => TRUE,
];
$form['overrides']['access_token'] = [
'#type' => 'textfield',
'#title' => $this
->t('Twitter Access Token'),
'#default_value' => $this
->defaultSettingValue('access_token'),
'#size' => 60,
'#maxlength' => 100,
'#required' => TRUE,
];
$form['overrides']['access_token_secret'] = [
'#type' => 'textfield',
'#title' => $this
->t('Twitter Access Token Secret'),
'#default_value' => $this
->defaultSettingValue('access_token_secret'),
'#size' => 60,
'#maxlength' => 100,
'#required' => TRUE,
];
$form['overrides']['tweets_count'] = [
'#type' => 'number',
'#title' => $this
->t('Tweets Count'),
'#default_value' => $this
->defaultSettingValue('tweets_count'),
'#size' => 60,
'#maxlength' => 100,
'#min' => 1,
];
$this
->blockFormElementStates($form);
return $form;
}