public function WebformContentCreatorManageFieldsForm::form in Webform Content Creator 3.x
Same name and namespace in other branches
- 8 src/Form/WebformContentCreatorManageFieldsForm.php \Drupal\webform_content_creator\Form\WebformContentCreatorManageFieldsForm::form()
- 2.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 65
Class
- WebformContentCreatorManageFieldsForm
- Form handler for the Webform content creator manage fields form.
Namespace
Drupal\webform_content_creator\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form['title'] = [
'#type' => 'textfield',
'#title' => $this
->t('Title'),
'#maxlength' => 255,
'#default_value' => $this->entity
->get('field_title'),
'#help' => $this
->t('Title of content created after webform submission. You may use tokens.'),
'#description' => $this
->t("Default value: webform title."),
'#weight' => 0,
];
$form['intro_text'] = [
'#markup' => '<p>' . $this
->t('You can create nodes based on webform submission values. In this page, you can do mappings between content type fields and webform submission values. You may also use tokens in custom text.') . '</p>',
];
if (\Drupal::service('module_handler')
->moduleExists('token')) {
$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 content type and webform.
$this
->constructTable($form);
return $form;
}