wrapMailLine example

    if (str_contains($text, "\n")) {
      // Remove trailing spaces to make existing breaks hard, but leave       // signature marker untouched (RFC 3676, Section 4.3).       $text = preg_replace('/(?(?<!^--) +\n| +\n)/m', "\n", $text);
      // Wrap each line at the needed width.       $lines = explode("\n", $text);
      array_walk($lines, '\Drupal\Core\Mail\MailFormatHelper::wrapMailLine', ['soft' => $soft, 'length' => strlen($indent)]);
      $text = implode("\n", $lines);
    }
    else {
      // Wrap this line.       static::wrapMailLine($text, 0, ['soft' => $soft, 'length' => strlen($indent)]);
    }
    // Empty lines with nothing but spaces.     $text = preg_replace('/^ +\n/m', "\n", $text);
    // Space-stuff special lines.     $text = preg_replace('/^(>| |From)/m', ' $1', $text);
    // Apply indentation. We only include non-'>' indentation on the first line.     $text = $indent . substr(preg_replace('/^/m', $clean_indent$text)strlen($indent));

    return $text;
  }

  
Home | Imprint | This part of the site doesn't use cookies.