Make a Link list and Submenu | Drupal 8

Make a Link list and Submenu

Submitted by editor on Thu, 05/26/2016 - 12:49
Question

How to make a link list / Sub menu in the main administration menu in drupal 8 ?

Example:

1. in yourmodule.links.menu.yml
yourmodule.test:
  title: Test
  parent: system.admin_config_development
  route_name: yourmodule.test

yourmodule.test.one:
  title: Test1
  parent: yourmodule.test
  route_name: yourmodule.test.one

yourmodule.test.two:
  title: Test2
  parent: yourmodule.test
  route_name: yourmodule.test.two

2. in yourmodule.routing.yml
yourmodule.test:
  path: '/admin/yourmodule/test'
  defaults:
    _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
    _title: 'Test'
  requirements:
    _permission: 'access administration pages'
    
yourmodule.test.one:
  path: '/admin/myx/myx_newsreader/crawl/readers'
  defaults:
    _controller: '\Drupal\yourmodule\Controller\Test::one'
    _title: 'One'
  requirements:
    _permission: 'access administration pages'

yourmodule.test.two:
  path: '/admin/myx/myx_newsreader/crawl/readers'
  defaults:
    _controller: '\Drupal\yourmodule\Controller\Test::two'
    _title: 'Two'
  requirements:
    _permission: 'access administration pages'

Example : Add item to site main menu

mymudule.teselink:
  title: Test
  menu_name: main
  route_name: mymudule.teselink

Comments

RenatoG (not verified)

Tue, 01/24/2017 - 14:40

Thanks you very much for your good job.

Regards.

Add new comment