For the complete documentation index, see llms.txt. This page is also available as Markdown.

Customizing Convivial Gov

Customize Morphos Theme

The Convivial Gov site template utilizes the Morphos theme, a component-based Drupal theme built with Tailwind CSS and Drupal Canvas.

Morphos is designed to be copied and customized rather than used as a base theme.

To clone the theme for your site, copy it into your custom themes directory:

mkdir -p web/themes/custom
cp -R web/themes/contrib/morphos web/themes/custom/morphos
git add web/themes/custom/morphos
composer remove morpht/morphos

This will create a copy of Morphos in web/themes/custom/morphos. This theme is yours, and you can customize it in any way you see fit.

Important: If you are using the default content, do not rename the theme. The components are namespaced to morphos, and renaming the theme will break them.

You should also ensure that morpht/morphos is removed from Composer (as shown above) so that it is not reinstalled or updated, which could conflict with your custom copy.

Create Custom Content Types

You can create your own custom content types. Each content type will have a Banner component displayed at the top of the page.

If you want full customization of how your content type is displayed, you will need to modify the full content view mode using Canvas.

Clone a Content Type

All content types that come with Convivial Gov share:

  • A standard set of reusable fields

  • Well-organized field grouping on the editing form

  • Consistent view modes

A lot of care has gone into getting these right.

We recommend creating your new content type first, then using the Field Tools module to clone the fields and displays from the Page content type. This way you get all of that work as your starting point.

Use the dev release of the Field Tools module and follow the steps below.

Steps

  1. Create the new content type

    • Go to Admin > Structure > Content types > Add content type (/admin/structure/types/add).

    • Enter the name and machine name for your new content type.

    • Configure the basic settings (publishing options, display settings, etc.) as needed.

    • Save the content type.

  2. Clone the fields

    • Go to the source content type's field list: Admin > Structure > Content types > Page > Manage fields.

    • Click the "Tools" tab.

    • Click "Clone fields".

    • Select all the fields you want to copy.

    • Under "Bundles to clone the fields to", check your new content type.

    • Submit the form to clone the fields.

  3. Clone the displays

    • Stay on the source content type's "Tools" tab.

    • Click "Clone displays".

    • Under "Form displays to clone", select the form modes you want to copy (e.g. default). Form displays control how fields are organized and grouped on the content editing form.

    • Under "View displays to clone", select the view modes you want to copy (e.g. default, full, teaser). The view displays control how content is rendered on the front end.

    • Under "Bundle to clone displays to", check your new content type.

    • Submit the form to clone the displays.

  4. Uninstall Field Tools

    • Once you have cloned the fields and displays, you can uninstall the Field Tools module. It is only needed for the cloning process.

After completing these steps, your new content type will have the same fields and display configuration as the original Page content type. You can then customize it as needed.

Customize the Full Content View Mode

The full content view mode uses a Canvas content template to control how the page is rendered. The best way to create a content template for a new content type is to clone the existing Page content template config.

Steps

  1. Export your site configuration:

  2. Find the content template config file. For the Page content type it is named canvas.content_template.node.mc_page.full.yml. You can also look at the recipe at recipes/convivial_gov/config/ for an example.

  3. Copy the file and rename it to match your new content type. For example, if your new content type machine name is my_content_type, name the file canvas.content_template.node.my_content_type.full.yml.

  4. Edit the file and update the id and content_entity_type_bundle values to match your new content type.

Note: Canvas does not yet have a feature to easily clone content templates, so this process requires some trial and error. Make sure you generate new UUIDs for each component and that the config dependencies are correct. Running drush config:import will flag any problems.

  1. Import the updated configuration:

Last updated