Skip to content

Instantly share code, notes, and snippets.

View VishalKumarSahu's full-sized avatar

Vishal Kumar Sahu VishalKumarSahu

View GitHub Profile
@LittleCoding
LittleCoding / myelement.html.twig
Created September 27, 2016 13:37
Current URL path via Twig in Drupal 8
{#
/**
* @file
* Get the current URL path via Drupal 8 route name and twig function.
*/
#}
<a href="{{ url('<current>') }}">Current page</a>
@henrytran9x
henrytran9x / function.php
Created January 3, 2017 09:06
Render menu navigation menu Drupal 8
<?php
function render_menu_navigation($menu_name,$theme_alter = ''){
//Set system menu mobile
$menu_tree = \Drupal::menuTree();
// Build the typical default set of menu tree parameters.
$parameters = $menu_tree->getCurrentRouteMenuTreeParameters($menu_name);
// Load the tree based on this set of parameters.
$tree = $menu_tree->load($menu_name, $parameters);
// Transform the tree using the manipulators you want.
$manipulators = array(