You are here

public function WebformContentCreatorManageFieldsForm::form in Webform Content Creator 2.x

Same name and namespace in other branches
  1. 8 src/Form/WebformContentCreatorManageFieldsForm.php \Drupal\webform_content_creator\Form\WebformContentCreatorManageFieldsForm::form()
  2. 3.x src/Form/WebformContentCreatorManageFieldsForm.php \Drupal\webform_content_creator\Form\WebformContentCreatorManageFieldsForm::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/WebformContentCreatorManageFieldsForm.php, line 55

Class

WebformContentCreatorManageFieldsForm
Form handler for the Webform content creator manage fields form.

Namespace

Drupal\webform_content_creator\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form['intro_text'] = [
    '#markup' => '<p>' . $this
      ->t('You can create content based on webform submission values. In this page, you can do mappings between bundle fields and webform submission values. You may also use tokens in custom text. You must map the required fields, otherwise content will not be created.') . '</p>',
  ];
  $form['tokens'] = [
    '#theme' => 'token_tree_link',
    '#token_types' => [
      'webform_submission',
    ],
    '#global_types' => TRUE,
    '#click_insert' => TRUE,
    '#show_restricted' => FALSE,
    '#recursion_limit' => 3,
    '#text' => $this
      ->t('Browse available tokens'),
  ];

  // Construct table with mapping between bundle and webform.
  $this
    ->constructTable($form);
  return $form;
}