Adding a new content block type
To add a new content block type, follow the instructions below:
Add the new type to Content Data API
We need to add the new type to the no_content
Parser as they do not need frontend Parsers, as in this commit
Open a pull request
Once these changes are made, open a pull request to Content Data API and get it approved
Create a new schema in Publishing API
Follow steps 1 to 5 in the instructions in Publishing API for adding a new schema
NOTE: Schemas MUST be prefixed with content_block_*
for Content Block Manager to pick them up.
If a content block type has embedded objects, you can use the embedded_object
helper, which ensures that all embedded
objects have a title and a key to ensure they can be referenced correctly (Example here)
Add expansion rules for your new schema
A good example is in this commit. Failure to do this will mean that updates to content will not get picked up when changes are made
Open a pull request
Once these changes are made, open a pull request to Publishing API and get it approved
Add the schema to Content Block Manager
Update the VALID_SCHEMAS
constant
in Content Block Manager (and, if necessary, the valid_schemas
method).
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 another pull request
Once these changes are made, open pull request to Whitehall and get these changes approved
Optional: Add a presenter to Content Block Tools
If there are any custom behaviours required for a content block, you can add a presenter to the Content Block Tools gem.
You can see an example presenter here.