public static Tags::encode($tag)
Encodes a tag string, taking care of special cases like commas and quotes.
string $tag: A tag string.
string The encoded string.
public static function encode($tag) { if (strpos($tag, ',') !== FALSE || strpos($tag, '"') !== FALSE) { return '"' . str_replace('"', '""', $tag) . '"'; } return $tag; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Tags.php/function/Tags::encode/8.1.x