The Drop Times: Upcoming Interview With Meilissa and April Sides
Axelerant Blog: How To Check PDFs For Accessibility
#! code: Drupal 10: Creating Context Aware Plugins
In previous articles I have written about injecting context into context aware plugins and creating custom context providers and wanted to complete the series by writing about creating context aware custom plugins.
The context system in Drupal is a powerful way of injecting dynamic data into plugins without writing code to add that data directly to the plugin itself. Instead of adding custom code to find the current user or the node from the route of the page you can inject the context into the plugin using the context system and add code to make use of that data. Although most commonly used in blocks it can be found in a couple of other plugin types in Drupal core, like the condition plugin for example.
In this article I will go through how to create a context aware plugin, including how to create custom plugins and how to allow that plugin to understand the context_definitions annotation. Once the custom plugin is complete we will render it using a Drupal controller action to prove that the context works correctly.
Let's start by creating a custom plugin, we'll call this plugin ContextThing and it will be used to print out the context passed to it. The first step in creating custom plugins is to create an Annotation class.
Plugin Annotation ClassAnnotations are special kinds of comments that have a number of functions in Drupal, but in this case we are using them to inform Drupal that a particular class is plugin.
As an example of annotations in action we can look at defining custom Blocks. To define a block plugin you would start the class annotation with @Block and then add the fields you need to the annotation definition. This would look something like this.
clemens-tolboom commented on issue Zireael07/FreeRoamRoguelikeRacerPrototype#8
I go back to my own project(s) for a week or two. CY
clemens-tolboom commented on issue Zireael07/FreeRoamRoguelikeRacerPrototype#8
removing the game/.godot then importing gave me
clemens-tolboom commented on issue Zireael07/FreeRoamRoguelikeRacerPrototype#8
Cleanup .tres find game/*/ -name "*.tres" -exec git checkout -- {} \; From the remaining untracked I guess racedriver2_ is from v3.x git clean -fd…
clemens-tolboom commented on issue Zireael07/FreeRoamRoguelikeRacerPrototype#8
Using find game/*/ -name "*.import" -exec git checkout -- {} \; left git status On branch 4.x Your branch is up to date with 'origin/4.x'. Changes …
The Drop Times: Drupal Camp Florida 2023 is Here!
clemens-tolboom opened an issue in Zireael07/FreeRoamRoguelikeRacerPrototype
Looks like lots of files are reimported. Do you have similar git status results? I thought we could ignore all .import but #7 ignore example shows …
clemens-tolboom opened a pull request in Zireael07/FreeRoamRoguelikeRacerPrototype
The godot specific .gitignore can be placed into game/ dir. See https://github.com/github/gitignore/blob/main/Godot.gitignore for current advised c…
+2 -0clemens-tolboom created a branch move-current-gitignore-into-game-dir-2 in clemens-tolboom/FreeRoamRoguelikeRacerPrototype
Updated Feb 17
clemens-tolboom deleted branch move-current-gitignore-into-game-dir at clemens-tolboom/FreeRoamRoguelikeRacerPrototype
Updated Feb 17
clemens-tolboom created a branch move-current-gitignore-into-game-dir in clemens-tolboom/FreeRoamRoguelikeRacerPrototype
Updated Feb 17
clemens-tolboom deleted branch move-current-gitignore-into-game-dir at clemens-tolboom/FreeRoamRoguelikeRacerPrototype
Updated Feb 17
clemens-tolboom closed a pull request in Zireael07/FreeRoamRoguelikeRacerPrototype
The godot specific .gitignore can be placed into game/ dir. See https://github.com/github/gitignore/blob/main/Godot.gitignore for current advised c…
+17,646 -19,825 1 commentclemens-tolboom commented on pull request Zireael07/FreeRoamRoguelikeRacerPrototype#6
Wrong version
clemens-tolboom opened a pull request in Zireael07/FreeRoamRoguelikeRacerPrototype
The godot specific .gitignore can be placed into game/ dir. See https://github.com/github/gitignore/blob/main/Godot.gitignore for current advised c…
+17,646 -19,825clemens-tolboom pushed to move-current-gitignore-into-game-dir in clemens-tolboom/FreeRoamRoguelikeRacerPrototype
- d205e88 Ignore Godot4 /.godot
clemens-tolboom created a branch move-current-gitignore-into-game-dir in clemens-tolboom/FreeRoamRoguelikeRacerPrototype
Updated Feb 17