How to do it...

  1. In our module's base directory, let's create a config directory with a schema subdirectory. In the subdirectory, create a file named mymodule.schema.yml that will hold your configuration entity's schema:
  1. In our mymodule.schema.yml, add a definition to mymodule.announcement.*: to provide our label and message storage:
# Schema for the configuration files of the Site Announcement. 
 
mymodule.announcement.*: 
  type: config_entity 
  label: 'Site announcement' 
  mapping: 
    id: 
      type: string 
      label: 'ID' 
    label: 
      type: label 
      label: 'Label' 
    message: 
      type: text 
      label: 'Text' 

We will define the configuration entity's namespace as an announcement, ...

Get Drupal 8 Development Cookbook - 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.