You are here

public function YamlFormSignature::formatText in YAML Form 8

Format an element's value as plain text.

Parameters

array $element: An element.

array|mixed $value: A value.

array $options: An array of options.

Return value

string The element's value formatted as plain text or a render array.

Overrides YamlFormElementBase::formatText

1 call to YamlFormSignature::formatText()
YamlFormSignature::buildExportRecord in src/Plugin/YamlFormElement/YamlFormSignature.php
Build an element's export row.

File

src/Plugin/YamlFormElement/YamlFormSignature.php, line 78

Class

YamlFormSignature
Provides a 'signature' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function formatText(array &$element, $value, array $options = []) {
  $format = $this
    ->getFormat($element);
  switch ($format) {
    case 'image':
    case 'status':
      $value = $value ? '[' . $this
        ->t('signed') . ']' : '[' . $this
        ->t('not signed') . ']';
  }
  return parent::formatText($element, $value, $options);
}