-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for virtual backoffice icons #12833
Added support for virtual backoffice icons #12833
Conversation
Hi there @abjerner, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Thanks very much @abjerner for providing a simple test case! We evaluated this one on UmbraCollab yesterday (https://youtu.be/pgelblKf7G8?t=501 somewhere after 15/20 minutes I believe) and ended up simplifying the code a lot. Until I read it again this morning and realized that wouldn't work for Linux, tested on Linux, didn't work, so now sadly we need to iterate all those directories indeed. Anyway, the other comment is that we have And finally, we're not sure what I think this PR is perfectly fine as it is, but it would be good to fix up that overwrite at some point! Thanks again, this one will be part of the upcoming 10.3.0! 🎉 |
Great to see this merged 👍 I was about to check on it since I didn't recall seeing any activity (somehow missed the notification). The use of I know about |
Prerequisites
Description
I was playing around with a new package I'm developing as a Razor Class Library, and noticed that my icon wasn't being picked up by Umbraco. I had a look through the
IconService
class, and realized it's only finding physical icons relative to the content root.On the other hand, translations from virtual language files work fine, so after digging a bit around in the source code, I found the
UmbracoBuilder.LocalizedText
class, which I've used for inspiration for this PR.My changes introduce a new
GetIconsFiles
method, which takes anIFileProvider
and a stringpath
as it's parameters, and then finds the SVG icon based on those two values. With this method, I could than add the following line to the existingGetAllIconFiles
method to find physical and virtual icons relative to the web root:The
GetAllIconFiles
method already handles physical icons relative to the content root. It doesn't support virtual files, so lines 108 to 137 could be replaced by the following line:I'm however not sure that RCL packages can have virtual files in the content root, which is why I did go along and replace the lines.
The implementation of the
GetIconsFiles
method is case insensitive, so it should match bothBackOffice
andbackoffice
- as well as.svg
and.SVG
. Although virtual icons hasn't been supported before, this should allow for people to stick with the deprecatedBackOffice
.Testing may be bit difficult, as it requires adding a RCL-based NuGet package that contains a virtual icon. The file below can however be used for testing this:
Limbo.Umbraco.Twitter.1.0.0-alpha001-build202208131106.nupkg.zip
It's my still-very-much-in-development package. The file is really just a
.nupkg
, but GitHub wouldn't let me upload it I didn't add the.zip
extension - so remember to rename it. When testing, I installed it as a local NuGet package in the Umbraco.Web.UI project.Then the
icon-limbo-twitter
icon should then be available via Umbraco's icon picker (eg. when creating a new document type):