Composer
TopicComposer is the preferred dependency management solution for PHP, is used by Drupal core, and is becoming increasingly popular for managing the modules and themes used for a Drupal project.
Use the Configuration API to access configuration data stored by a module, provide default configuration, create settings forms, and other tasks such as overriding settings for a local environment.
Controllers
TopicControllers are the portion of a Drupal module that handle responding to an incoming request with the appropriate response data.
CSS in Drupal
TopicCascading Style Sheets (CSS) files are added as an asset library through a theme’s libraries configuration file. HTML attributes, including classes and IDs, are commonly added in template files with Twig.
Routing
TopicDrupal's Routing API maps the URL of an incoming request to the code responsible for generating the content that is rendered in response.
Security
TopicKeeping a Drupal site secure requires monitoring security announcements, performing regular updates, and knowing how to properly use Drupal’s APIs to write secure code.
Drupal Composer Project
TopicThe Drupal Composer Project provides a scaffold for starting a new Drupal project and managing that project's dependencies with Composer. It was created before the drupal/recommended-project Composer project template was developed, which is the current best practice method for creating a new Drupal site with Composer.
YAML
TopicYAML, which stands for YAML Ain't Markup Language, is a human-readable data serialization format that's been widely adopted in a variety of use cases in Drupal.
Performance and scalability determine how fast your application can serve a page and to how many users at a time.
Events
TopicEvents are one of the ways that module developers can alter or extend Drupal without modifying existing code.
Caching in Drupal
TopicCaching in Drupal is controlled by Drupal's Cache API which is used to store any type of data on a permanent or temporary basis. Some types of data tend to take a long time to compute, but utilizing the Cache API in your module can help your site load data more quickly.
Learn about resources to guide you through the process of updating a module or theme to the latest version of Drupal.
In Drupal’s core library there are a number of utility functions and classes that, as a module developer, you will find make your task easier or less tedious.
Plugins (Plugin API)
TopicPlugins are one of the ways that module developers can write code that extends Drupal. The Drupal Plugin API allows a module to provide functionality in an extensible, object-oriented way.
Upgrading is the process of moving your site from a previous major version of Drupal to a newer version, for example from Drupal 7 to Drupal 8 or Drupal 9 to Drupal 10.
The Migrate API can be used to import content from an older Drupal site (Drupal 7 or older), or any other data source, into the current version of Drupal.
Themes provide the HTML, CSS, JavaScript, and other assets that are responsible for the look and feel of your site.
The Render API consists of a standard format for describing data using structured arrays and a process for converting those arrays into the HTML a user sees when interacting with a Drupal site.
Drupal Core Modules
TopicA module is a set of PHP, JavaScript, and/or CSS files that extends site features and adds functionality. The Drupal core software comes with a set of modules that provide a range of features.
YAML, which stands for YAML Ain't Markup Language, is a human-readable data serialization format that's been widely adopted in a variety of use cases in Drupal. Anyone wanting to write modules, or themes, for Drupal will need to understand YAML syntax. Even site builders are likely to encounter YAML at least in passing as YAML is the data-serialization format of choice for Drupal's configuration management system. Good thing it's pretty easy to learn even with the most basic of programming backgrounds.
This tutorial will look at the YAML data format and provide examples of how to write and read YAML. Starting with an introduction to the language's syntax and some of the strengths of YAML. Then looking at the difference between scalar data types like strings and integers, and collection data types like lists and associative arrays.
Since YAML in the Drupal world is read into PHP and ultimately becomes a PHP data structure that we can use in our own code we'll also look at how the YAML we write in a .yml file is represented in PHP data types. To do this we'll use the YAML Sandbox module that provides a handy textarea into which we can type YAML and have it parsed into PHP data structures.
Learning objectives
- Explain what YAML is and its strengths as a data serialization format
- Create scalar key/value pairs in YAML
- Create lists, and associative arrays using YAML collections
- Understand how the YAML you write is represented in PHP
Tips
- In Drupal, use the .yml extension and not .yaml
- Ensure your code editing application is configured to use spaces (preferably 2 spaces, as per Drupal coding standards), not the tab character when the TAB key is pressed. If you have tab characters in a YAML file within a Drupal environment, a fatal PHP error will be thrown and you'll see a White Screen of Death (WSOD).
- Copy and paste from an existing YAML file to ensure the formatting is correct, and edit from there.
Additional resources
- http://www.yaml.org
- YAML Sandbox module
- Find other tutorials and external resources related to YAML on our YAML topic page (Drupalize.Me)