You are here

public function WebformNodeElement::form in Webform Node Element 8

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 WebformMarkupBase::form

File

src/Plugin/WebformElement/WebformNodeElement.php, line 33

Class

WebformNodeElement
Provides a 'webform_node_element' element.

Namespace

Drupal\webform_node_element\Plugin\WebformElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['node_element'] = [
    '#title' => $this
      ->t('Node Details'),
    '#type' => 'fieldset',
  ];
  $form['node_element']['webform_node_element_nid'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Node ID'),
    '#description' => $this
      ->t('The ID of the node to render. The node will be displayed using the "webform_element" display mode. You can leave this empty and write an EventHandler to change the node or display mode dynamically.'),
  ];
  return $form;
}