Skip to content
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

Allow for passing custom icons to CP Nav Items #2890

Merged
merged 3 commits into from
Nov 25, 2020
Merged

Allow for passing custom icons to CP Nav Items #2890

merged 3 commits into from
Nov 25, 2020

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Nov 21, 2020

This pull request allows for developers to pass custom SVG icons to their Control Panel Nav Items. This PR closes #1452.

Here's a quick overview of the things I've changed:

  • When creating a NavItem and using the ->icon() method, a developer can either provide the name of an icon in Statamic's resources/svg directory or they can provide a string of an SVG.

  • Instead of using the @svg blade directive to display icons, I've changed it for a inlining it with Blade. This works for both Statamic icons and custom SVGs as they are all strings when they are returned from the ->setter method.

I've had to change the way this part works because we're no longer pulling from the statamic/svg folder. Instead, we're just outputting a string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to add a custom icon to a nav item created by an addon
2 participants