You are here

protected function StripWhitespaceTrait::stripWhitespace in Fences 8.2

Remove HTML whitespace from a string.

Parameters

string $string: The input string.

Return value

string The whitespace cleaned string.

1 call to StripWhitespaceTrait::stripWhitespace()
FieldOutputTest::testFieldOutput in tests/src/Kernel/FieldOutputTest.php
Test the field output.

File

tests/src/Traits/StripWhitespaceTrait.php, line 19

Class

StripWhitespaceTrait
A trait to strip whitespace.

Namespace

Drupal\Tests\fences\Traits

Code

protected function stripWhitespace($string) {
  $no_whitespace = preg_replace('/\\s{2,}/', '', $string);
  $no_whitespace = str_replace("\n", '', $no_whitespace);
  return $no_whitespace;
}