Skip to content

Instantly share code, notes, and snippets.

View chloecorfmat's full-sized avatar
🐘
Learning, learning, always learning !

Chloé Corfmat chloecorfmat

🐘
Learning, learning, always learning !
View GitHub Profile
@chloecorfmat
chloecorfmat / D8LoadMenuEntries.php
Last active September 16, 2020 08:11
D8 : Load menu entries from menu and menu_root
<?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 September 16, 2020 08:10
D8 : Get current path alias
$path = \Drupal::service('path.current')->getPath();
$alias = \Drupal::service('path.alias_manager')->getAliasByPath($path);