In Drupal 7 the Content Modelling part of the development process usually happens primarily in the user interface:
- You create a new content type
- You add and configure the fields you need
- You configure the view modes (often using contributed modules such as Display Suite or Entity view modes)
At some point down the road, however, you need to write some custom code. Maybe you need fine-grained access logic or you need to display information in a way that the generic formatters do not cover. So often enough you end up with some of the logic in the user interface and some of it in code.
While Drupal 8 makes managing fields from the user interface all the more powerful, the underlying APIs make it convenient to define an entity type in code from start to end. This greatly improves not only the developer experience when dealing with entities but also maintainability, reusability and performance.
What to expect
In this workshop we will cover (among others):
- Registering an entity type with Drupal
- Defining the base fields (think: properties) of our entity type
- Implementing custom access logic
- Configuring the widgets and formatters for our fields
- Configuring view and form displays
- Adding custom output to the displays
And all that without touching the user interface! We will also give an outlook to some of the more advanced capabilities of the Entity API that we cannot hand-code in the scope of the workshop.