You are here

public function SharethisConfigurationForm::buildForm in Sharethis block 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/SharethisConfigurationForm.php, line 32

Class

SharethisConfigurationForm
Configure sharethis for this site.

Namespace

Drupal\sharethis_block\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('sharethis_block.configuration');
  $form['property_id'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Property ID'),
    '#description' => $this
      ->t('The unique property ID from your sharethis account.'),
    '#default_value' => $config
      ->get('sharethis_property'),
  ];
  $form['inline'] = [
    '#type' => 'radios',
    '#options' => [
      '1' => 'Inline',
      '0' => 'Sticky',
    ],
    '#required' => TRUE,
    '#title' => $this
      ->t('Inline or sticky'),
    '#description' => $this
      ->t('Whether to show inline buttons, placed with the block, or sticky buttons on the side or bottom of the page.'),
    '#default_value' => $config
      ->get('sharethis_inline'),
  ];
  return parent::buildForm($form, $form_state);
}