Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Make a Link list and Submenu

By editor , 26 May, 2016
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

Tags

  • Drupal 8
  • Code
  • Module
  • Add new comment

Comments2

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

RenatoG (not verified)

9 years 10 months ago

Very good!

Thanks you very much for your good job.

Regards.

  • Reply

Bart Gysens (not verified)

9 years 8 months ago

Thank you!

Great listing.

  • Reply

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer