Repository navigation
Home
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
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.
Import taxonomy terms into existing vocabularies, including optional URL aliases.
Create sample nodes using existing content types and supported field types.
Import sample images and documents into Backdrop's managed file system.
Create navigation links in existing menus, including parent-child relationships.
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.
Apply supported settings to existing Layouts, including templates and page title behavior.
Add, remove, move, and configure supported blocks within existing Layout regions.
Flush selected image styles without requiring a global cache flush.
Backdrop Theme Setup separates native configuration from optional setup operations.
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.
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.
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.
The project follows several principles:
- Reusability: Shared functions should work with different Backdrop themes.
- Native APIs: Reuse existing Backdrop functionality rather than reinventing it.
- Separation of responsibilities: Keep native configuration separate from sample data and setup operations.
- Administrator control: Setup operations should be optional and explicitly selected.
- Portability: Avoid hard-coded entity IDs whenever possible.
- Targeted cache management: Avoid unnecessary global cache clearing.
- Compatibility: Minimize unintended changes to existing site content and configuration.
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.
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.