- To get the current path or arg(1) etc.
$request = \Drupal::request();
$current_path = $request->getPathInfo();
$path_args = explode('/- TO Get Node pathalias.
function bootstrap_preprocess_node(&$variables) {
$node = $variables['elements']['#node'];
$node_detail = $node->toArray();
$node_detail['path'][0]['alias'];
}
No comments:
Post a Comment