Add field(s) to menu link? Is there a way to add field(s) to menu links in Drupal 8? Like an image field to output above certain links?
Add this code to your custom module:

function my_module_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
  if ($entity_type-&gt;id() === 'menu_link_content') {
    $fields['menu_link_image'] = BaseFieldDefinition::create('image')
      -&gt;setLabel(t('Menu link image'))
      -&gt;setDescription(t('Upload the image related to this menu item'))
      -&gt;setDisplayOptions('form', array('type' =&gt; 'string', 'weight' =&gt; 0));

    return $fields;
  }
}


Then use hook_update_n to update the schema of the menu_link_content_data table. Run update.php, flush caches and the new field should appear on all the Add/Edit menu item form.



In case someone wants to simply add a text field, boolean etc, simply edit BaseFieldDefinition::create('image') and change it to BaseFieldDefinition::create('string') or BaseFieldDefinition::create('boolean') etc