I need to build a main menu that is a subset of the regular menu. The design team thinks it would be better for user to have only the most important links in the main menu and not have everything. Some links are top level menu and some are sub menus. For this I was hoping to be able to add a field to the menu link item form as a drop down. When creating a link the user could use this dropdown to "promoteToMainMenuAsBigLink" or "promoteToMainMenuAsSmallLink" or leave none to not show the item on the main menu.
I'm looking for a similar solution as this Drupal 7 solution but for Drupal 8.
I was hoping to be able to add a column in the table menu_link_content_data beside 'expanded'. I was hoping not to have to record this information in an other table like shown in the d7 solution.
I was able to add a field to the link form in a custom module I build, just for test purpose I only added a text field to start with:
custom_menu.module:
function custom_menu_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if($form_id == 'menu_link_content_menu_link_content_form') {
$form['promoteToMainMenu'] = array(
'#type' => 'textfield',
'#title' => t('Promote to main menu'),
'#description' => t('Promote link menu to main menu.'),
'#default_value' => '',
'#weight' => -9
);
}
}
The field is indeed shown in the link form but it is never recorded.
Can someone help me with this?