You are here

public function YamlFormCompositeBase::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

1 call to YamlFormCompositeBase::prepare()
YamlFormLocation::prepare in src/Plugin/YamlFormElement/YamlFormLocation.php
Prepare an element to be rendered within a form.
1 method overrides YamlFormCompositeBase::prepare()
YamlFormLocation::prepare in src/Plugin/YamlFormElement/YamlFormLocation.php
Prepare an element to be rendered within a form.

File

src/Plugin/YamlFormElement/YamlFormCompositeBase.php, line 49

Class

YamlFormCompositeBase
Provides a base for composite elements.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

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

  // If #flexbox is not set or an empty string, determine if the
  // form is using a flexbox layout.
  if (!isset($element['#flexbox']) || $element['#flexbox'] === '') {
    $yamlform = $yamlform_submission
      ->getYamlForm();
    $element['#flexbox'] = $yamlform
      ->hasFlexboxLayout();
  }
}