You are here

public function YamlFormBlock::blockForm in YAML Form 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/YamlFormBlock.php, line 81

Class

YamlFormBlock
Provides a 'Form' block.

Namespace

Drupal\yamlform\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['yamlform_id'] = [
    '#title' => $this
      ->t('Form'),
    '#type' => 'entity_autocomplete',
    '#target_type' => 'yamlform',
    '#required' => TRUE,
    '#default_value' => $this
      ->getYamlForm(),
  ];
  $form['default_data'] = [
    '#title' => $this
      ->t('Default form submission data (YAML)'),
    '#description' => $this
      ->t('Enter form submission data as name and value pairs which will be used to prepopulate the selected form. You may use tokens.'),
    '#type' => 'yamlform_codemirror',
    '#mode' => 'yaml',
    '#default_value' => $this->configuration['default_data'],
  ];
  $form['token_tree_link'] = $this->tokenManager
    ->buildTreeLink();
  return $form;
}