In this tutorial, I will show you how to handle new requirements for data storage by creating two smaller abstract classes out of our original data storage class. By creating these new abstract classes, we can build more flexibility into our code.
Additional resources
Now that we have created new abstract classes, we need to load and utilize them in our code. In this tutorial, I will show you how we can refactor our code to make use of our new abstract data loading classes.
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
Automated Testing in Drupal
CourseManaging Media in Drupal
CourseConfiguration Entities
CourseConfiguration Management
CourseTheming Drupal Sites
CourseViews for Developers
CourseWeb Services in Drupal
CourseComposer
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.
Dependency Injection
TopicDependency injection is a design pattern commonly used in object-oriented software architectures in order to support Inversion of Control.