Skip to content
shabib edited this page Nov 7, 2026 · 3 revisions

Backdrop Theme Setup

A reusable, JSON-driven setup library for Backdrop CMS themes.

Backdrop Theme Setup is an experimental project designed to help theme developers configure common website features without writing custom PHP import and setup functions for every theme.

The project demonstrates how Backdrop CMS's built-in APIs, Configuration Management, Views, and Layouts can work together to simplify theme development and website setup.

Repository: https://github.com/shabib-m/backdrop_theme_setup

Why Backdrop Theme Setup?

Creating a complete Backdrop theme often involves more than writing templates and CSS.

Theme developers may also want to provide:

  • Sample content and images.
  • Taxonomy terms.
  • Navigation menu links.
  • Preconfigured Views.
  • Layout templates and block placements.
  • Optional setup controls in the theme settings interface.

Backdrop already provides powerful tools for managing these features.

The purpose of Backdrop Theme Setup is to make those tools easier to use through reusable PHP functions and JSON configuration files.

Key Features

Taxonomy Term Import

Import taxonomy terms into existing vocabularies, including optional URL aliases.

Sample Content Import

Create sample nodes using existing content types and supported field types.

Managed File Import

Import sample images and documents into Backdrop's managed file system.

Menu Link Import

Create navigation links in existing menus, including parent-child relationships.

Views Taxonomy Filters

Update taxonomy filters in existing Views by resolving term IDs dynamically.

This avoids relying on hard-coded taxonomy term IDs that may differ between installations.

Layout Configuration

Apply supported settings to existing Layouts, including templates and page title behavior.

Layout Block Management

Add, remove, move, and configure supported blocks within existing Layout regions.

Image Style Management

Flush selected image styles without requiring a global cache flush.

How It Works

Backdrop Theme Setup separates native configuration from optional setup operations.

Native Backdrop Configuration

The theme's config directory can contain supported Backdrop configuration files, such as:

  • Taxonomy vocabularies.
  • Content types.
  • Field definitions and instances.
  • Views.

These files use Backdrop's native Configuration Management format.

JSON-Driven Setup Operations

The settings-content directory contains JSON files describing additional setup operations.

Examples include:

  • Importing sample taxonomy terms.
  • Creating sample content.
  • Importing menu links.
  • Updating existing Views filters.
  • Configuring Layouts and blocks.

The reusable library reads these files and performs the corresponding operations through Backdrop APIs.

Project Structure

backdrop_theme_setup/
├── backdrop_theme_setup.info
├── theme-settings.php
├── includes/
│   └── theme-setup.inc
├── config/
│   └── [optional native Backdrop configuration]
└── settings-content/
    ├── taxonomy/
    │   └── terms.json
    ├── content/
    │   └── content.json
    ├── menu/
    │   └── links.json
    ├── views/
    │   └── filters.json
    ├── layouts/
    │   ├── settings.json
    │   └── blocks.json
    └── files/
        └── [sample images and documents]

The config directory is optional and is used for supported native Backdrop configuration.

The settings-content directory contains the configuration files processed by the Theme Setup library.

Design Principles

The project follows several principles:

  1. Reusability: Shared functions should work with different Backdrop themes.
  2. Native APIs: Reuse existing Backdrop functionality rather than reinventing it.
  3. Separation of responsibilities: Keep native configuration separate from sample data and setup operations.
  4. Administrator control: Setup operations should be optional and explicitly selected.
  5. Portability: Avoid hard-coded entity IDs whenever possible.
  6. Targeted cache management: Avoid unnecessary global cache clearing.
  7. Compatibility: Minimize unintended changes to existing site content and configuration.

Project Status

Backdrop Theme Setup is currently a proof of concept.

The project is intended to demonstrate a reusable approach and encourage discussion within the Backdrop CMS community.

It is not yet presented as a production-ready setup framework.

Additional testing, validation, documentation, and API improvements may be required.

Documentation

Feedback and Contributions

Feedback from Backdrop developers, theme designers, and site builders is welcome.

We are particularly interested in:

  • Improving the reusable library architecture.
  • Compatibility with existing Backdrop installations.
  • JSON validation and error handling.
  • Better integration with Configuration Management.
  • Automated testing.
  • Evaluating whether a contributed module would be a better long-term implementation.

GitHub Repository: https://github.com/shabib-m/backdrop_theme_setup

Report Issues: https://github.com/shabib-m/backdrop_theme_setup/issues

Backdrop CMS: https://backdropcms.org/


Making Backdrop theme setup more reusable, accessible, and easier to maintain.