Module Development

Introduction to Interfaces for Drupal 8, 9

Sprout Video

We have an abstract class with methods that we require, but there’s no logic in these abstract methods. This is a perfect opportunity to use interfaces. In this tutorial, I will show you how to create and implement Interfaces. I will also explain how interfaces are useful when you will be sharing your code. But even if you’re not creating interfaces to share, chances are, if you’re using open source code — and definitely in Drupal — you will need to know how to implement interfaces.

Additional resources

Object Interfaces (PHP Manual)