Inform modules that a menu link has been created.
This hook is used to notify modules that menu links have been created. Contributed modules may use the information to perform actions based on the information entered into the menu system.
\Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link: A menu link entity.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_menu_link_insert(\Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link) {
// In our sample case, we track menu items as editing sections
// of the site. These are stored in our table as 'disabled' items.
$record['mlid'] = $menu_link
->id();
$record['menu_name'] = $menu_link->menu_name;
$record['status'] = 0;
drupal_write_record('menu_example', $record);
}