You are here

public function FixedBlockContentBlock::blockForm in Fixed Block Content 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/FixedBlockContentBlock.php, line 92

Class

FixedBlockContentBlock
Provides a fixed content block placement.

Namespace

Drupal\fixed_block_content\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $fixed_block = FixedBlockContent::load($this
    ->getDerivativeId());
  $options = $this->entityDisplayRepository
    ->getViewModeOptionsByBundle('block_content', $fixed_block
    ->getBlockContentBundle());
  $form['view_mode'] = [
    '#type' => 'select',
    '#options' => $options,
    '#title' => $this
      ->t('View mode'),
    '#description' => $this
      ->t('Output the block in this view mode.'),
    '#default_value' => isset($this->configuration['view_mode']) ? $this->configuration['view_mode'] : '',
    '#access' => count($options) > 1,
  ];
  return $form;
}