You are here

public function Table::prepare in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/Table.php \Drupal\webform\Plugin\WebformElement\Table::prepare()

Prepare an element to be rendered within a webform.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission. Webform submission is optional since it is not used by composite sub elements.

Overrides WebformElementBase::prepare

See also

\Drupal\webform\Element\WebformCompositeBase::processWebformComposite

File

src/Plugin/WebformElement/Table.php, line 61

Class

Table
Provides a 'table' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
  parent::prepare($element, $webform_submission);

  // Add .js-form.wrapper to fix #states handling.
  $element['#attributes']['class'][] = 'js-form-wrapper';

  // Disable #tree for table element. Webforms do not support the #tree
  // property.
  $element['#tree'] = FALSE;
}