Search by

drupal / kern_canvas

Drupal-Infrastructure

Kern Canvas - A customizable site template for Drupal CMS

Package info

git.drupalcode.org/project/kern_canvas.git

Homepage

Issues

Type:drupal-recipe

pkg:composer/drupal/kern_canvas

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

1.0.0-alpha3 2026-11-24 11:43 UTC

This package is auto-updated.

Last update: 2026-11-24 10:46:13 UTC


README

A Drupal CMS site template for websites of the German public administration.

Overview

Kern Canvas combines the KERN UX design system with Drupal Canvas. It installs the KERN UX theme with its Canvas sub-theme kern_ux_canvas, so editors build pages from accessible KERN components. The template integrates with Drupal CMS 2.x and appears in the site template selection during installation.

Features

  • KERN UX components (section, heading, text, button, card, accordion, icon, divider) available in Drupal Canvas
  • German demo homepage built with these components
  • German as the default language
  • Drupal CMS foundation: media library, SEO, privacy and forms

Requirements

  • Drupal CMS 2.2 or higher (Drupal core 11.4+)
  • PHP 8.3+
  • Composer 2.x

Installation

Kern Canvas and the KERN UX theme are in alpha. A Drupal CMS project only accepts stable packages by default, so both packages are required with an exact version. No change to minimum-stability is needed.

Require drupal/kern_ux at exactly 1.0.0-alpha2. The patches in patches/ are made for this version and may not apply to a later one.

Option 1: New site

composer create-project drupal/cms my-site && cd my-site
composer require drupal/kern_canvas:1.0.0-alpha3 drupal/kern_ux:1.0.0-alpha2

Next, add the patches as described in Patches for KERN UX and Canvas. Without them, some components are broken or missing in the Canvas component library.

Then install the site in one of two ways:

  • Browser: open the site, select "Kern Canvas" from the site template list and complete the installation wizard.
  • Drush:

    drush site:install ../recipes/kern_canvas --site-name="My site"
    

    Pass --site-name. Without it, Drush replaces the site name set by the template with its own default.

Option 2: Existing site

composer require drupal/kern_canvas:1.0.0-alpha3 drupal/kern_ux:1.0.0-alpha2

Add the patches as described in Patches for KERN UX and Canvas, then apply the template:

drush recipe ../recipes/kern_canvas

Applying the template to an existing site changes the default theme, the front page, the site name and the default language (German). Back up the site first.

German interface translations

The template adds German and makes it the default language. If the administration interface is still English after installation, import the translations:

drush locale:check
drush locale:update

Where the recipe goes after composer require

Drupal CMS unpacks recipes. After composer require finishes:

  • The recipe is copied to recipes/kern_canvas in the project root.
  • drupal/kern_canvas is removed from the project's composer.json again. Its dependencies, such as drupal/kern_ux, are added there instead.

This is intended: a recipe is applied once and is not a runtime dependency. As a result, composer update does not bring newer versions of the recipe. The theme and modules it installed still update through Composer as usual.

Patches for KERN UX and Canvas

KERN UX 1.0.0-alpha2 has bugs in its Canvas components, and some components have no Canvas wrapper yet. Until the fixes are in a KERN UX release, the recipe ships them as patches in patches/. The patches are made for drupal/kern_ux 1.0.0-alpha2 and must be applied in this order:

PatchFixes
kern_ux-u2-canvas-button-wrapper.patchButton renders without label and icon, and fails SDC validation
kern_ux-u3-canvas-card-missing-link.patchCard includes a missing link component and is disabled in Canvas
kern_ux-u4-kopfzeile-missing-component.patchKopfzeile setting renders a missing component
kern_ux-u5-canvas-wrappers.patchCanvas wrappers for badge, dialog, alert, loader, progress, summary and tasklist
kern_ux-u6-canvas-group-names.patchInconsistent component group names
kern_ux-u7-richtext-kern-classes.patchKERN classes for links, tables, description lists and details in rich text
kern_ux-u8-navbar-footer-layout.patchNavbar and footer dark mode colours and content alignment
kern_ux-u9-canvas-hide-feedback-components.patchKeeps Alert, Loader and Progress out of the Canvas component library

One more patch is for drupal/canvas 1.13.0:

PatchFixes
canvas-3592055-hide-folders-with-only-disabled-items.patchThe component library shows empty groups for components that are all disabled (#3592055)

A recipe cannot apply patches on its own: Drupal CMS unpacks the recipe and does not copy patch definitions into the project. Add them to the project yourself after composer require:

  1. Install the patch plugin and allow it:

    composer config allow-plugins.cweagans/composer-patches true
    composer require cweagans/composer-patches:^1.7
    
  2. Add the patches to extra in the project's composer.json:

    "patches": {
        "drupal/kern_ux": {
            "Canvas button wrapper": "recipes/kern_canvas/patches/kern_ux-u2-canvas-button-wrapper.patch",
            "Canvas card missing link": "recipes/kern_canvas/patches/kern_ux-u3-canvas-card-missing-link.patch",
            "Kopfzeile missing component": "recipes/kern_canvas/patches/kern_ux-u4-kopfzeile-missing-component.patch",
            "Canvas wrappers": "recipes/kern_canvas/patches/kern_ux-u5-canvas-wrappers.patch",
            "Canvas group names": "recipes/kern_canvas/patches/kern_ux-u6-canvas-group-names.patch",
            "Rich text KERN classes": "recipes/kern_canvas/patches/kern_ux-u7-richtext-kern-classes.patch",
            "Navbar and footer layout": "recipes/kern_canvas/patches/kern_ux-u8-navbar-footer-layout.patch",
            "Canvas hide feedback components": "recipes/kern_canvas/patches/kern_ux-u9-canvas-hide-feedback-components.patch"
        },
        "drupal/canvas": {
            "#3592055 Hide folders with only disabled items": "recipes/kern_canvas/patches/canvas-3592055-hide-folders-with-only-disabled-items.patch"
        }
    }
    
  3. Update the lock file. The patch plugin then reinstalls the patched packages and applies the patches:

    composer update --lock
    

    Do not use composer reinstall drupal/kern_ux for this. With a changed patch list it fails and leaves the theme uninstalled.

Do this before you install the site with the Kern Canvas template. Remove the patches when KERN UX and Canvas releases contain the fixes.

Customization

After installation, you can customize your site through:

  1. Appearance: Navigate to Admin > Appearance to configure the theme
  2. Content Types: Admin > Structure > Content types
  3. Menus: Admin > Structure > Menus
  4. Blocks: Admin > Structure > Block layout

Development

Setting Up Local Development

# Using DDEV
mkdir my-site && cd my-site
ddev config --project-type=drupal11 --docroot=web
ddev start
ddev composer create-project drupal/cms
ddev composer require drupal/kern_canvas:1.0.x-dev drupal/kern_ux:1.0.0-alpha2
# Add the patches, see "Patches for KERN UX and Canvas".
ddev drush site:install ../recipes/kern_canvas --site-name="Kern Canvas"

Exporting Changes

drush site:export is a Drupal CMS command. It writes the current site, its configuration and its content, as a site template into the given directory. Use it to carry changes made in the admin UI back into the recipe:

drush site:export ../recipes/kern_canvas

The command overwrites files in the destination. Review the result with git diff before committing: the export contains the whole site, including configuration that does not belong in the template.

Screenshot

See SCREENSHOT.md for the size and content of the preview image shown in the installer.

Contributing

Contributions are welcome. Report bugs and propose changes in the issue queue. Changes are submitted as merge requests from issue forks, as described in the drupal.org contribution guide.

License

GPL-2.0-or-later

Support