You are here

public static function WebformHtmlHelper::hasBlockTags in Webform 8.5

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

Check if text has HTML (block level) tags.

Parameters

string $string: Text that may contain HTML tags.

Return value

bool TRUE is text contains HTML (block level) tags.

2 calls to WebformHtmlHelper::hasBlockTags()
WebformElementBase::isMultiline in src/Plugin/WebformElementBase.php
Checks if the element value could contain multiple lines.
WebformHtmlHelperTest::testHasBlockTags in tests/src/Unit/Utility/WebformHtmlHelperTest.php
Tests WebformHtmlHelper::hasBlockTags().

File

src/Utility/WebformHtmlHelper.php, line 78

Class

WebformHtmlHelper
Provides HTML helper functions.

Namespace

Drupal\webform\Utility

Code

public static function hasBlockTags($string) {
  $re_block = '/<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|p|h[1-6]|hr|br)/i';
  return preg_match($re_block, $string) ? TRUE : FALSE;
}