You are here

public function WebformAttachmentTwig::form in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_attachment/src/Plugin/WebformElement/WebformAttachmentTwig.php \Drupal\webform_attachment\Plugin\WebformElement\WebformAttachmentTwig::form()

Gets the actual configuration webform array to be built.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array An associative array contain the element's configuration webform without any default values.

Overrides WebformAttachmentBase::form

File

modules/webform_attachment/src/Plugin/WebformElement/WebformAttachmentTwig.php, line 35

Class

WebformAttachmentTwig
Provides a 'webform_attachment_twig' element.

Namespace

Drupal\webform_attachment\Plugin\WebformElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['attachment']['template'] = [
    '#type' => 'webform_codemirror',
    '#mode' => 'twig',
    '#title' => $this
      ->t('Twig'),
  ];
  $form['attachment']['help'] = WebformTwigExtension::buildTwigHelp();
  WebformElementHelper::setPropertyRecursive($form['attachment']['help'], '#access', TRUE);
  return $form;
}