You are here

public function BootstrapLanguagesBlock::blockForm in Bootstrap Languages 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/BootstrapLanguagesBlock.php, line 23

Class

BootstrapLanguagesBlock
Provides a 'Bootstrap Languages' block.

Namespace

Drupal\bootstrap_languages\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $settings = $config['bootstrap_language'];
  $form['bootstrap_language'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Bootstrap settings'),
    '#open' => TRUE,
  ];
  $form['bootstrap_language']['dropdown_style'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Dropdown display style'),
    '#options' => [
      'all' => $this
        ->t('Icons and text'),
      'icons' => $this
        ->t('Only icons'),
    ],
    '#default_value' => !empty($settings['dropdown_style']) ? $settings['dropdown_style'] : 'all',
  ];
  return $form;
}