You are here

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

File

src/Plugin/YamlFormElement/Password.php, line 22

Class

Password
Provides a 'password' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function formatText(array &$element, $value, array $options = []) {
  $format = $this
    ->getFormat($element);
  switch ($format) {
    case 'obscured':
      return '********';
    default:
      return parent::formatText($element, $value, $options);
  }
}