content-block-manager: Adding a new schema
To add a new content block schema, follow the instructions below:
Add the new type to Content Block Manager
Schemas are defined in the Schema definitions directory in a JSON schema format.
This represents the shape of the data which will be stored in a content block's details field.
Once the schema is defined, you must define it as a supported schema in the
VALID_SCHEMAS constant within the Schema class
so that it can be used in Content Block Manager.
Schemas can be defined as live or alpha. live schemas are visible in production, and can be accessed by anyone.
alpha schemas are only visible in integration/staging or for users with the SHOW_ALL_CONTENT_BLOCK_TYPES role
in production.
Add tests for the new schema
You should add tests for the new schema in the Schema tests directory, following the pattern of the existing tests. If the schema has specific validation rules, ensure these are covered too.
Add any customisations
There is a config file which allows you to configure how the schema is presented in Content Block Manager.
See all available configuration variables
Open a pull request
Once these changes are made, open a pull request to Content Block Manager and get these changes approved
Add support to Content Block Tools
Once the block is added to Content Block Manager, you must define it as a supported content block in the Content Block Tools gem.
Supported content blocks are defined in the SUPPORTED_DOCUMENT_TYPES constant within the ContentBlockReference class.
If there are any custom behaviours required for a content block, you can also add a component to the Content Block Tools gem.
You can see an example component here.