WireTextTools::collapse()

Collapse string to plain text that all exists on a single long line without destroying words/punctuation.

Usage

// basic usage
$string = $wireTextTools->collapse(string $str);

// usage with all arguments
$string = $wireTextTools->collapse(string $str, array $options = []);

Arguments

NameType(s)Description
$strstring

String to collapse

$options (optional)array
  • stripTags (bool): Strip markup tags? Default:true
  • keepTags (array): Array of tag names to keep, if stripTags==true. Default:[]
  • collapseLinesWith (string): String to collapse newlines with. Default:' '
  • linksToUrls (bool): Convert links to "(url)" rather than removing entirely? Default:false 3.0.132
  • endBlocksWith (string): Character or string to insert to identify paragraph/header separation Default:''
  • convertEntities (bool): Convert entity-encoded characters to text? Default:true

Return value

string


WireTextTools methods and properties

API reference based on ProcessWire core version 3.0.251