You are here

public function ContactPopupBlock::blockForm in Contact Form Popup 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/ContactPopupBlock.php, line 111

Class

ContactPopupBlock
Provides a 'ContactPopupBlock' block.

Namespace

Drupal\contact_poup\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $form['contact_form'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Contact form'),
    '#description' => $this
      ->t('Select the contact form to use.'),
    '#options' => $this
      ->listContactForms(),
    '#default_value' => isset($config['contact_form']) ? $config['contact_form'] : '',
  );
  $form['link_title'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('The link title'),
    '#description' => $this
      ->t('The title to use for the link. Leave empty for using the contact form label.'),
    '#default_value' => isset($config['link_title']) ? $config['link_title'] : '',
  );
  return $form;
}