Closed nzdev closed 1 year ago
One way you could do that is by adding the relevant custom class to the item. Then when you're rendering your menu, use that class, and build the link manually:
<a href="@item.Url()" target="@item.Target"><i class="fas @item.CustomClasses"></i>@item.Title</a>
Edit: fixed error in my code. Thanks Aaron.
I had a choice when I implemented the image picker.
Originally it was a free text field, however I felt that wasn't user friendly.
I'm not sure how I could implement both an icon (free text) and image picker side-by-side.
Open to suggestions at this point 😕
One way you could do that is by adding the relevant custom class to the item. Then when you're rendering your menu, use that class, and build the link manually:
<a href="@item.Url()@item.Anchor" target="@item.Target"><i class="fas @item.CustomClasses"></i>@item.Title</a>
@tzbarkan item.Url() should contain the Anchor automatically, and you shouldn't need to specify both properties
An image picker with the option to restrict by folder and type would work well.
@nzdev I will need to look into this.
I will probably add a setting which will allow you to set this at data type level.
PRs welcome
How can I get the Url of the Image/Icon?
@allysonhw The image is stored as an IPublishedContent, so you can use the normal process such as .Url() or .GetCropUrl()
Is your feature request related to a problem? Please describe. It would be awesome (potentially font awesome), to be able to pick an icon to go along with the navigation item
Describe the solution you'd like It would be great to have an option to select an icon from an icon set and or provide an icon name to use.
Describe alternatives you've considered Some other icon to menu item map.