How to do it...

  1. Since content entity bundles are configuration entities, we will need to define our configuration entity schema. Create a config/schema directory and mymodule.schema.yml file that will contain the configuration entity's schema:
mymodule.message_type.*: 
  type: config_entity 
  label: 'Message type settings' 
  mapping: 
    id: 
      type: string 
      label: 'Machine-readable name' 
    uuid: 
      type: string 
      label: 'UUID' 
    label: 
      type: label 
      label: 'Label' 
    langcode: 
      type: string 
      label: 'Default language' 

We will define the configuration entity's config prefix as message_type, which we will provide to Drupal in the entity's annotation block. We will tell Drupal that this is a config_entity and provide a label for the schema.

With the mapping array, we provide ...

Get Drupal 8 Development Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.