public static function Tags::encode
public static Tags::encode($tag)
Encodes a tag string, taking care of special cases like commas and quotes.
Parameters
string $tag: A tag string.
Return value
string The encoded string.
File
- core/lib/Drupal/Component/Utility/Tags.php, line 51
Class
- Tags
- Defines a class that can explode and implode tags.
Namespace
Drupal\Component\UtilityCode
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