public static function SynonymsEntityAutocomplete::extractEntityIdFromAutocompleteInput in Synonyms 8
Extracts the entity ID from the autocompletion result.
Parameters
string $input: The input coming from the autocompletion result.
Return value
mixed|null The return value
1 call to SynonymsEntityAutocomplete::extractEntityIdFromAutocompleteInput()
- SynonymsEntityAutocomplete::validateEntityAutocomplete in src/
Element/ SynonymsEntityAutocomplete.php - Form element validation handler for synonyms_entity_autocomplete elements.
File
- src/
Element/ SynonymsEntityAutocomplete.php, line 142
Class
- SynonymsEntityAutocomplete
- Form element for synonyms-friendly entity autocomplete.
Namespace
Drupal\synonyms\ElementCode
public static function extractEntityIdFromAutocompleteInput($input) {
$match = NULL;
// Take "label (entity id)', match the ID from parenthesis when it's a
// number.
if (preg_match("/.+\\s\\((\\d+)\\)/", $input, $matches)) {
$match = $matches[1];
}
return $match;
}