Content entity bundles

We have written a neat little piece of functionality. There are still improvements that we can, and will make, but those are for later chapters when we cover other topics that we will need to learn about. Now, however, let's take a step back to our content entity type and extend our products a bit by enabling bundles. We want to have more than one type of product that can be imported. And this will be a bundle which will be an option to choose when creating an Importer configuration. However, first, let's make the product entity type "bundleable".

We start by adjusting our Product entity plugin annotation:

/** * Defines the Product entity. * * @ContentEntityType( *   ... *   label = @Translation("Product"), * bundle_label ...

Get Drupal 8 Module Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.