MyAccountMenu component is used to add a link to the page in the navigation bar.
The component has two key methods: one to add to a group and one to add entries to groups.
To create a new entry in the menu :
- Create an object to represent how you want the entry to behave
- Use the MyAccountMenu component’s method to add it
Once the method has been called and the object verified, the menu will automatically update to include your new entry.
mountToApp: function mountToApp (container)
{
var MyAccountMenu = container.getComponent('MyAccountMenu');
var termsAndConditionsGroupEntry = {
id: 'termsandconditions'
, groupid: 'settings'
, index: 99
, url: 'update-terms-and-conditions'
, name: _.translate('Terms and Conditions')
}
MyAccountMenu.addGroupEntry(termsAndConditionsGroupEntry);
return new TermsAndConditionsMyAccountRouter(container)
}
id— id assigned to the newly entered linkgroupid— this is the group you want to add it to, and you can quickly find the menu IDs by inspecting the group’s node and reading itsdata-idattribute valueindex—number where its to be appear, indexes start at 0url— url of newly created linkname— Name of the link to be added
save the code run it locally
