You are here

public static function YamlFormCodeMirror::processYamlFormCodeMirror in YAML Form 8

Processes a 'yamlform_codemirror' element.

File

src/Element/YamlFormCodeMirror.php, line 80

Class

YamlFormCodeMirror
Provides a form element for HTML, YAML, or Plain text using CodeMirror.

Namespace

Drupal\yamlform\Element

Code

public static function processYamlFormCodeMirror(&$element, FormStateInterface $form_state, &$complete_form) {

  // Check that mode is defined and valid, if not default to (plain) text.
  if (empty($element['#mode']) || !isset(self::$modes[$element['#mode']])) {
    $element['#mode'] = 'text';
  }
  return $element;
}