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.
Xdebug
TopicDebugging your Drupal codebase can be made substantially easier by learning how to enable and configure the Xdebug PHP extension.
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.
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.
Twig is a template engine for PHP, which is the language used in Drupal. Twig can be used to design templates in generic PHP applications as well as Drupal themes.
Object-Oriented PHP
TopicObject-oriented PHP utilizes classes and objects to organize code into reusable chunks. This approach helps us organize complex applications, such as Drupal, into modular code called classes that can be reused across the entire system.
Configuration API in Drupal
CourseEntity API in Drupal
CourseOn occasion, you may need to modify the behavior of entity types defined by another module. Thankfully, Drupal includes several alter hooks that can be used to override the behavior of another entity.
In this tutorial, we will:
- Walk through the common Entity API hooks
- Look at example implementations of each
- And discuss the use cases for each
By the end of this tutorial, you will have a better understanding of how to override the default behavior of an entity type provided by Drupal core (or another contributed module) within your custom code.
The Typed Data API in Drupal helps add additional functionality to PHP's built-in data types, making working with data in Drupal much more predictable. It allows code to make intelligent guesses about the type of data that a field on an entity contains. For example, differentiating between a string of text and a string of text that represents a URL.
In this tutorial, we'll:
- Look at the 3 main types of typed data in Drupal: primitives, complex data, and lists.
- See how different data types and definitions are defined, and show how to define your own data type.
- Look at the interfaces provided by each data type to see some of the benefits of adding this abstraction layer.
By the end of this tutorial, you should have a better understanding of what the Typed Data API is, where you'll most likely encounter it, and how to use it in your code.
Entity CRUD (Create, Read, Update, and Delete) operations are handled via the EntityTypeManager service.
In this tutorial we'll:
- Learn how to use the
EntityTypeManagerservice to perform basic CRUD operations with examples you can copy/paste - Access both property and field values of an entity
- Update entities by setting new field values and then saving the object
By the end of this tutorial, you'll be able to understand Entity CRUD operations and be well on your way to becoming comfortable with accessing and manipulating entity values in code.