-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor icon installation by simplifying hook
- Loading branch information
1 parent
7bf3c2f
commit 26d9fdb
Showing
3 changed files
with
5 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
from __future__ import annotations | ||
|
||
try: | ||
from wagtail import hooks | ||
except ImportError: | ||
from wagtail.core import hooks | ||
from pathlib import Path | ||
|
||
from .icons import Heroicon | ||
from wagtail import hooks | ||
|
||
|
||
@hooks.register("register_icons") | ||
def register_icons(icons): | ||
for icon in Heroicon.get_icons(): | ||
icons.append(str(icon.path)) | ||
return icons | ||
template_dir = Path(__file__).parent / "templates" / "heroicons" | ||
heroicons = [file.stem for file in template_dir.glob("*.svg")] | ||
return icons + heroicons |
This file was deleted.
Oops, something went wrong.