From af5ba75c1c56229371c70ee0ad89ecb0812ae66b Mon Sep 17 00:00:00 2001 From: Cellou Diallo Date: Sat, 25 May 2024 03:14:32 +0200 Subject: [PATCH] Create UI Icons module and display bootstrap icons --- src/Controller/IconDisplayController.php | 39 ++++++++++++++++++++ src/Plugin/IconHandler/CustomIconHandler.php | 1 + ui_icons.iconset.yml | 6 +++ ui_icons.info.yml | 8 ++++ ui_icons.routing.yml | 7 ++++ 5 files changed, 61 insertions(+) create mode 100644 src/Controller/IconDisplayController.php create mode 100644 src/Plugin/IconHandler/CustomIconHandler.php create mode 100644 ui_icons.iconset.yml create mode 100644 ui_icons.info.yml create mode 100644 ui_icons.routing.yml diff --git a/src/Controller/IconDisplayController.php b/src/Controller/IconDisplayController.php new file mode 100644 index 0000000..44258ab --- /dev/null +++ b/src/Controller/IconDisplayController.php @@ -0,0 +1,39 @@ +getIconsets(); + foreach ($iconsets as $iconset_id=>$label) { + $iconset = \Drupal::service('strategy.manager.iconset')->getInstance($iconset_id); + $icons = $iconset->getIcons(); + $build[] = [ + '#type' => 'html_tag', + '#tag' => 'h2', + '#value' => $label, +]; + foreach ($icons as $icon_id => $icon) { + $build[] = $iconset->build($icon_id); + } +} + return $build; + } + +} diff --git a/src/Plugin/IconHandler/CustomIconHandler.php b/src/Plugin/IconHandler/CustomIconHandler.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/src/Plugin/IconHandler/CustomIconHandler.php @@ -0,0 +1 @@ +