You are here

public function NodeFormBlock::blockForm in Form Block 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Block/NodeFormBlock.php \Drupal\formblock\Plugin\Block\NodeFormBlock::blockForm()

Overrides \Drupal\block\BlockBase::blockForm().

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/NodeFormBlock.php, line 91

Class

NodeFormBlock
Provides a block for node forms.

Namespace

Drupal\formblock\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['formblock_node_type'] = [
    '#title' => $this
      ->t('Node type'),
    '#description' => $this
      ->t('Select the node type whose form will be shown in the block.'),
    '#type' => 'select',
    '#required' => TRUE,
    '#options' => $this
      ->getNodeTypes(),
    '#default_value' => $this->configuration['type'],
  ];
  $form['formblock_show_help'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show submission guidelines'),
    '#default_value' => $this->configuration['show_help'],
    '#description' => $this
      ->t('Enable this option to show the submission guidelines in the block above the form.'),
  ];
  return $form;
}