You are here

public function ContactBlock::blockForm in Contact Block 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/ContactBlock.php, line 174

Class

ContactBlock
Provides a 'ContactBlock' block.

Namespace

Drupal\contact_block\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $options = $this->entityTypeManager
    ->getStorage('contact_form')
    ->loadMultiple();
  foreach ($options as $key => $option) {
    $options[$key] = $option
      ->label();
  }
  $form['contact_form'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Contact form'),
    '#options' => $options,
    '#default_value' => $this->configuration['contact_form'],
    '#required' => TRUE,
  ];
  return $form;
}