function EntityLinkSuggestionsController::findEntityIdByUrl
Finds entity ID from the given input.
Parameters
string $target_entity_type_id: An entity type to get suggestions for.
string $user_input: The string to url parse.
Return value
string|null An entity ID parsed from the user input, otherwise NULL.
File
-
core/
modules/ ckeditor5/ src/ Controller/ EntityLinkSuggestionsController.php, line 309
Class
- EntityLinkSuggestionsController
- Returns responses for entity link suggestions autocomplete route.
Namespace
Drupal\ckeditor5\ControllerCode
protected static function findEntityIdByUrl(string $target_entity_type_id, string $user_input) : ?string {
$expected_url_prefix = "/{$target_entity_type_id}/";
if (str_starts_with($user_input, $expected_url_prefix)) {
return substr($user_input, strlen($expected_url_prefix));
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.