You are here

public function Table::prepare in YAML Form 8

Prepare an element to be rendered within a form.

Parameters

array $element: An element.

\Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission: A form submission.

Overrides YamlFormElementBase::prepare

File

src/Plugin/YamlFormElement/Table.php, line 59

Class

Table
Provides a 'table' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function prepare(array &$element, YamlFormSubmissionInterface $yamlform_submission) {
  parent::prepare($element, $yamlform_submission);

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

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