From a40c582eb791f9f13cc689de403930533cfb2a8d Mon Sep 17 00:00:00 2001 From: rdrew Date: Mon, 13 May 2024 11:58:58 -0300 Subject: [PATCH] 1st --- css/library-fundraiser.css | 5 +++ library_fundraiser.info.yml | 13 ++++++ library_fundraiser.libraries.yml | 0 library_fundraiser.module | 0 src/Plugin/Block/LibraryFundraiserBlock.php | 42 +++++++++++++++++++ .../block--libraryfundraiserblock.html.twig | 4 ++ templates/library-fundraiser-block.html.twig | 4 ++ 7 files changed, 68 insertions(+) create mode 100644 css/library-fundraiser.css create mode 100644 library_fundraiser.info.yml create mode 100644 library_fundraiser.libraries.yml create mode 100644 library_fundraiser.module create mode 100644 src/Plugin/Block/LibraryFundraiserBlock.php create mode 100644 templates/block--libraryfundraiserblock.html.twig create mode 100644 templates/library-fundraiser-block.html.twig diff --git a/css/library-fundraiser.css b/css/library-fundraiser.css new file mode 100644 index 0000000..e29d3e0 --- /dev/null +++ b/css/library-fundraiser.css @@ -0,0 +1,5 @@ + +/* Add your custom CSS styles here */ +.library-fundraiser-block { + /* Define your styles */ +} diff --git a/library_fundraiser.info.yml b/library_fundraiser.info.yml new file mode 100644 index 0000000..b6e01c5 --- /dev/null +++ b/library_fundraiser.info.yml @@ -0,0 +1,13 @@ +name: 'Library Fundraiser' +type: module +description: 'Creates a custom block for library fundraising purposes.' +core_version_requirement: ^10 +package: Custom +dependencies: + - block + +libraries: + - library_fundraiser/library-fundraiser-styles: + css: + theme: + css/library-fundraiser.css: {} diff --git a/library_fundraiser.libraries.yml b/library_fundraiser.libraries.yml new file mode 100644 index 0000000..e69de29 diff --git a/library_fundraiser.module b/library_fundraiser.module new file mode 100644 index 0000000..e69de29 diff --git a/src/Plugin/Block/LibraryFundraiserBlock.php b/src/Plugin/Block/LibraryFundraiserBlock.php new file mode 100644 index 0000000..bb7e7a3 --- /dev/null +++ b/src/Plugin/Block/LibraryFundraiserBlock.php @@ -0,0 +1,42 @@ + + .libfund_block { + background: green; + } + +
+

It works

+
'; + $build = [ + '#theme' => 'library_fundraiser_block', + '#markup' => \Drupal\Core\Render\Markup::create($html), + ]; + + // Attach the library. + $build['#attached']['library'][] = 'library_fundraiser/library-fundraiser-styles'; + + return $build; + } + +} diff --git a/templates/block--libraryfundraiserblock.html.twig b/templates/block--libraryfundraiserblock.html.twig new file mode 100644 index 0000000..9413e07 --- /dev/null +++ b/templates/block--libraryfundraiserblock.html.twig @@ -0,0 +1,4 @@ + +
+ {{ content }} +
diff --git a/templates/library-fundraiser-block.html.twig b/templates/library-fundraiser-block.html.twig new file mode 100644 index 0000000..9413e07 --- /dev/null +++ b/templates/library-fundraiser-block.html.twig @@ -0,0 +1,4 @@ + +
+ {{ content }} +