My initial goal was to create a menu item that linked to a view that I had configured and that was being created on installation of the module, by including the view config file.
To do this, I just needed to configure the menu link in the view before exporting the config file and the link is created automatically.
You can create a view simply by including the config file in the module config directory.
To create a link to a existing node, one can look at the standard install profile in core for some excellent sample code.
// Create a Home link in the main menu.
$item = array(
'link_title' => st('Home'),
'link_path' => '<front>',
'menu_name' => 'main-menu',
'weight' => -1,
);
menu_link_save($item);
// Create a login link in the account menu.
$item = array(
'link_title' => st('Login'),
'link_path' => 'user/login',
'menu_name' => 'user-menu',
'weight' => -1,
);
menu_link_save($item);
// Update the menu router information.
menu_rebuild();
My initial goal was to create a menu item that linked to a view that I had configured and that was being created on installation of the module, by including the view config file.
To do this, I just needed to configure the menu link in the view before exporting the config file and the link is created automatically.
You can create a view simply by including the config file in the module config directory.
To create a link to a existing node, one can look at the standard install profile in core for some excellent sample code.