Selected Session

Workshop: Level-up your Drupal application with custom entities

Speaker(s)
Tobias Zimmermann
Proposed Track(s)
Development
Level of expertise
Intermediate
Session Type
Long (4h)
Day
Thursday
Time Slot
-

Today's web application is more than just an editorial interface with a couple of content types. You want custom data structures that precisely fit your business case and you want to apply custom logic to the validation, display and lifecycle of that data.

In this extended workshop we will explore the exciting frontier that lies beyond the comfortable - but limited - realm of nodes and node types. We will start by creating a custom entity type from scratch and covering integral concepts of the Entity API such as fields and handlers in the process. We will then learn how we can use Drupal's building blocks to create and view our entities from the user interface. Because of Drupal's generic architecture this will already allow us to use our entities in various other parts of Drupal such as Views, Search API or JSON API. From there we will approach topics such as custom validation logic and computed fields that show off the benefit of using a custom entity.

Depending on the attendees' interests and as time permits we can enhance our custom entity with additional features:

  • Bundles: We can differentiate different kinds or types of our entities and different logic depending on the type
  • Revisions: We can track changes to our entities and to allow rollbacks of previous versions and also integration with the Workspaces module
  • Workflows: We can send our entities through custom workflows to match our business processes
  • Composite/Inline entities: When your entities become more complex it is often helpful to separate parts of them out into separate data structures while still allowing them to be managed within the context of the original entity
  • ... (If you've already worked with custom entities before, please bring your questions and comments!)