Add Custom Tokens in Custom Module for Drupal 9

grayscale photography of person holding coin or token

In Drupal 9, you can create custom tokens using the Token API for your custom module. The Token API provides a central API for modules to use to provide tokens. Tokens are placed into text by using the [type:token] syntax, where type is the machine-readable name of the token type, and token is the machine-readable name of the token within the type.

Drupal: An Open Source Content Management System for Websites and Applications

Drupal is a popular open-source content management system (CMS) that has been around for over two decades. It is widely used for creating websites, intranets, and web applications, and is known for its scalability, security, and flexibility. With a large and active community of developers and users, Drupal has a wealth of modules and themes available that can be easily integrated into projects.

Update Drupal 9 core via composer on your local environment

Drupal
  1. Open the terminal app (or the terminal in VS Code) and change to the root site directory of the site you are updating
    cd [path/to/site/root/directory]
  2. Switch to the main branch and fetch the latest changes
    git checkout master
    git fetch --all
    git pull
  3. Create a new branch from the main branch for the Drupal core update
    git checkout -b update/core-[version]
  4. Upda