You are here

protected static function WebformYaml::normalize in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Utility/WebformYaml.php \Drupal\webform\Utility\WebformYaml::normalize()

Convert \r\n to \n inside data.

Parameters

array $data: Data with all converted \r\n to \n.

1 call to WebformYaml::normalize()
WebformYaml::encode in src/Utility/WebformYaml.php
Encodes data into the serialization format.

File

src/Utility/WebformYaml.php, line 109

Class

WebformYaml
Provides YAML tidy function.

Namespace

Drupal\webform\Utility

Code

protected static function normalize(array &$data) {
  foreach ($data as $key => &$value) {
    if (is_string($value)) {
      $data[$key] = preg_replace('/\\r\\n?/', "\n", $value);
    }
    elseif (is_array($value)) {
      static::normalize($value);
    }
  }
}