You are here

public function WebformComputedTwig::form in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformComputedTwig.php \Drupal\webform\Plugin\WebformElement\WebformComputedTwig::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 WebformComputedBase::form

File

src/Plugin/WebformElement/WebformComputedTwig.php, line 35

Class

WebformComputedTwig
Provides a 'webform_computed_twig' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['computed']['help'] = WebformTwigExtension::buildTwigHelp();
  $form['computed']['template']['#mode'] = 'twig';

  // Set #access so that help is always visible.
  WebformElementHelper::setPropertyRecursive($form['computed']['help'], '#access', TRUE);
  return $form;
}