cag51
0
Q:

drupal 8 get node from path alias

// Get node from path alias.
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias');

if(preg_match('/node\/(\d+)/', $path, $matches)) {
  $node = \Drupal\node\Entity\Node::load($matches[1]);
}
0

New to Communities?

Join the community