Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have a URI 'entity:node/27' and I want to load this entity, but I cannot find the correct helper function or class to use.
I do not want to explode the string or regex the string, I am fairly sure there is a function for this.
$params = Url::fromUri("internal:" . $source_uri)->getRouteParameters();
$entity_type = key($params);
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($params[$entity_type]);
Required, but never shown