function synonyms_autocomplete_escape in Synonyms 7
Escape string to safely use in autocomplete text field as default value.
Parameters
string $value: String to be escaped
Return value
string Escaped string $value
2 calls to synonyms_autocomplete_escape()
- synonyms_autocomplete_format in ./
synonyms.pages.inc - Supportive function to format autocomplete suggestions.
- synonyms_field_widget_form in ./
synonyms.module - Implements hook_field_widget_form().
File
- ./
synonyms.module, line 1520 - Provide synonyms feature for Drupal entities.
Code
function synonyms_autocomplete_escape($value) {
// Commas or quotes must be wrapped in quotes.
if (strpos($value, ',') !== FALSE || strpos($value, '"') !== FALSE) {
$value = '"' . str_replace('"', '""', $value) . '"';
}
return $value;
}