You are here

public function ShareMessageBlock::blockForm in Share Message 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/ShareMessageBlock.php, line 87

Class

ShareMessageBlock
Provides a 'ShareMessage' block with the AddThis widgets.

Namespace

Drupal\sharemessage\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $sharemessages = $this->storageController
    ->loadMultiple();
  $options = [];
  foreach ($sharemessages as $sharemessage) {
    $options[$sharemessage
      ->id()] = $sharemessage
      ->label();
  }
  $form['sharemessage'] = [
    '#type' => 'select',
    '#title' => t('Select the sharemessage that should be displayed'),
    '#default_value' => $this->configuration['sharemessage'],
    '#options' => $options,
  ];
  return $form;
}