In Drupal 7 we would define all of our menu links in a single hook_menu, or maybe alter them with hook_menu_alter.  In Drupal 8 though this has morphed into three different files for our menu items depending on the type you are trying to create.  For creating local actions (the buttons), you will need to add your page definition into a links.action.yml file for your module.

If your link is for a new entity you will want to make sure that your link is inline with the entity machine name, this is so that drupal 8 can find it.  Your Route name and the machine name of your link should match exactily.

Parameters:

  • title - The display title that will show on the menu
  • route_name - the machine name for your link
  • weight - works the same in previous versions of drupal
  • class - you can define a custom class that will manage the output of your link.
  • appears_on - define one or more paths that this local action will appear on.
Tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

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