Drupal 10: Using A Lazy Builder To Create A Dynamic Button
Adding dynamic and interactive elements to a web page can be a challenge, and there are a few techniques available in Drupal to allow for this.
Drupal 10: Using Parameter Converters To Create Paths For Custom Entities
Drupal's path system gives authors the ability to override the path of an item of content. Whilst the internal path of a page might be "/node/1" the external path can be anything you want, and can be set when editing the item of content.
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 complet
Drupal 10: Migrating Flags With The Migrate Module
I've been doing a bit of Drupal migration recently, and one of the tasks I have undertaken is to migrate "likes" from a Drupal 7 site to a Drupal 10 site.
Drupal 10: Programmatically Injecting Context Into Blocks
Context definitions in Drupal are really useful when you want to inject context into your plugins and I have been using them for a little while now. It has made building custom blocks to add content to pages much easier as I don't need to copy the same block of code to find an entity of a particular sort into the block plugin.
Drupal 10: Creating Custom Context Providers
I previously looked at injecting context providers into context aware plugins. This time I will explore more about creating our own context providers to plug into this system.
Submitted by Sarah Jay on Tue, 08/30/2016 - 20:46Permalink
Short, cool and informative. Thank you!
Submitted by Josip Rajkovic on Wed, 10/17/2018 - 15:04Permalink
To get the currently selected language for content :
Submitted by tty11 on Thu, 02/07/2019 - 09:17Permalink
Thank you Philip. I did not have the interface translation enabled so your snipped was always returning the default language. The snipped posted by "tty11" worked. Thanks tty11 :), however I will make a small change to it. Drupal couldn't find "LanguageInterface" in my theme's preprocess function, I had to provide namespace too as follows
Submitted by Ejay Rus on Fri, 12/11/2020 - 09:57Permalink
Thanks Ejay. I wrote this post during my first few weeks of Drupal 8 development. I've since learned a lot about how the language manager works so there are probably a few contextual issues with my original snippet :)
Submitted by philipnorton42 on Fri, 12/11/2020 - 12:15Permalink
Add new comment