You are here

protected function StripWhitespaceTrait::stripWhitespace in Video Embed Field 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/StripWhitespaceTrait.php \Drupal\Tests\video_embed_field\Kernel\StripWhitespaceTrait::stripWhitespace()

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::getPreparedFieldOutput in tests/src/Kernel/FieldOutputTest.php
Get and prepare the output of a field.

File

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

Class

StripWhitespaceTrait
Strip whitespace.

Namespace

Drupal\Tests\video_embed_field\Kernel

Code

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