Skip to content

Instantly share code, notes, and snippets.

Avatar
🐘
Learning, learning, always learning !

Chloé Corfmat chloecorfmat

🐘
Learning, learning, always learning !
View GitHub Profile
@chloecorfmat
chloecorfmat / D8LoadMenuEntries.php
Last active Sep 16, 2020
D8 : Load menu entries from menu and menu_root
View D8LoadMenuEntries.php
<?php
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Url;
class Controller extends ControllerBase {
function loadAdminMenuEntries($menu_root, $menu_name = 'admin') {
$menu_items = [];
@chloecorfmat
chloecorfmat / D8GetCurrentPathAlias.php
Created Sep 16, 2020
D8 : Get current path alias
View D8GetCurrentPathAlias.php
$path = \Drupal::service('path.current')->getPath();
$alias = \Drupal::service('path.alias_manager')->getAliasByPath($path);
You can’t perform that action at this time.