You are here

public function YamlFormMarkupBase::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 YamlFormMarkupBase::prepare()
YamlFormMessage::prepare in src/Plugin/YamlFormElement/YamlFormMessage.php
Prepare an element to be rendered within a form.
1 method overrides YamlFormMarkupBase::prepare()
YamlFormMessage::prepare in src/Plugin/YamlFormElement/YamlFormMessage.php
Prepare an element to be rendered within a form.

File

src/Plugin/YamlFormElement/YamlFormMarkupBase.php, line 41

Class

YamlFormMarkupBase
Provides a base 'markup' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

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

  // Hide markup element is it should be only displayed on 'view'.
  if (isset($element['#display_on']) && $element['#display_on'] == 'view') {
    $element['#access'] = FALSE;
  }
}