How do I create a bundle under my custom content entity type in Drupal 8? I am working on creating a base list entity type I will call CustomList for the sake of this question. I pair it up with CustomListItem so that I have an entity type to define the list and another to define the items in the list.

I intend to create bundles underneath these to build a custom cart, a saved item list, and an item group list.

So far everything I have found in Drupal 8 either creates Node Bundles (which I don't want) or a bundle of config yaml files to define the bundle (in this case ECK did this for me). But nothing useful on how to create a bundle under a specific entity type.

Would I just declare a new entity type and do something in the annotations to make it a bundle? If so I am unsure as to what annotation to use or how to use it.

Thanks,
Patrick
Yes, you declare a config entity type to store the bundle definitions. For example that for Custom Block Types (bundle of block_content):

Drupal\block_content\Entity\BlockContentType

namespace Drupal\block_content\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\block_content\BlockContentTypeInterface;

/**
 * Defines the custom block type entity.
 *
 * @ConfigEntityType(
 *   id = "block_content_type",
 *   label = @Translation("Custom block type"),
 *   handlers = {
 *     "form" = {
 *       "default" = "Drupal\block_content\BlockContentTypeForm",
 *       "add" = "Drupal\block_content\BlockContentTypeForm",
 *       "edit" = "Drupal\block_content\BlockContentTypeForm",
 *       "delete" = "Drupal\block_content\Form\BlockContentTypeDeleteForm"
 *     },
 *     "list_builder" = "Drupal\block_content\BlockContentTypeListBuilder"
 *   },
 *   admin_permission = "administer blocks",
 *   config_prefix = "type",
 *   bundle_of = "block_content",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label"
 *   },
 *   links = {
 *     "delete-form" = "/admin/structure/block/block-content/manage/{block_content_type}/delete",
 *     "edit-form" = "/admin/structure/block/block-content/manage/{block_content_type}",
 *     "collection" = "/admin/structure/block/block-content/types",
 *   },
 *     ...
 * )
 */
class BlockContentType extends ConfigEntityBundleBase implements BlockContentTypeInterface {


Which is then referenced in the content entity type:

Drupal\block_content\Entity\BlockContent

*   bundle_entity_type = "block_content_type",


If you use Drupal Console to generate a custom content entity type and you say yes to the question if you want bundles, this config entity type is set up for you automatically.