You are here

protected function WebformTranslationConfigManager::alterHtmlEditorElement in Webform 6.x

Alter text area element and convert it to an HTML editor.

Parameters

array $element: A element containing 'source' and 'translation'.

2 calls to WebformTranslationConfigManager::alterHtmlEditorElement()
WebformTranslationConfigManager::alterConfigWebformFormHandlers in src/WebformTranslationConfigManager.php
Alter the webform configuration form handlers.
WebformTranslationConfigManager::alterSchemaElementsRecursive in src/WebformTranslationConfigManager.php
Alter schema elements.

File

src/WebformTranslationConfigManager.php, line 885

Class

WebformTranslationConfigManager
Defines a class to translate webform config.

Namespace

Drupal\webform

Code

protected function alterHtmlEditorElement(array &$element) {

  // Undo nl2br() so that the HTML markup's spacing is correct.
  // @see \Drupal\config_translation\FormElement\FormElementBase::getSourceElement
  // @see https://stackoverflow.com/questions/2494754/opposite-of-nl2br-is-it-str-replace
  $element['source']['#markup'] = preg_replace("#<br />\$#m", "", (string) $element['source']['#markup']);
  $element['translation']['#type'] = 'webform_html_editor';
}