YamlFormMarkup.php in YAML Form 8
File
src/Plugin/YamlFormElement/YamlFormMarkup.php
View source
<?php
namespace Drupal\yamlform\Plugin\YamlFormElement;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Mail\MailFormatHelper;
class YamlFormMarkup extends YamlFormMarkupBase {
public function getDefaultProperties() {
return parent::getDefaultProperties() + [
'markup' => '',
];
}
public function buildText(array &$element, $value, array $options = []) {
$element['#markup'] = MailFormatHelper::htmlToText($element['#markup']);
return parent::buildText($element, $value, $options);
}
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['markup']['markup'] = [
'#type' => 'yamlform_html_editor',
'#title' => $this
->t('HTML markup'),
'#description' => $this
->t('Enter custom HTML into your form.'),
];
return $form;
}
}