You are here

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

File

src/Plugin/YamlFormElement/YamlFormLocation.php, line 75

Class

YamlFormLocation
Provides an 'location' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

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

  // Hide all composite elements by default.
  $composite_elements = $this
    ->getCompositeElements();
  foreach ($composite_elements as $composite_key => $composite_element) {
    if ($composite_key != 'value' && !isset($element['#' . $composite_key . '__access'])) {
      $element['#' . $composite_key . '__access'] = FALSE;
    }
  }
}