Skip to content

About

A lightweight Backdrop CMS module that helps theme designers export site configurations, sample content, and layouts into JSON files for use with the Theme Setup library.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Theme Setup Builder

Theme Setup Builder is a development module for Backdrop CMS that helps theme designers create themes, export site configuration, and prepare sample-content packages for the Theme Setup library.

Instead of manually creating theme files and writing JSON, designers can use Backdrop's administration interface to create a theme, build a demonstration site, and export the configuration and content they want to distribute with their theme.

The module uses Backdrop's native APIs and Configuration Management (CMI) to keep the development workflow simple and reduce the learning curve for theme designers.

Requirements and installation

  • Backdrop CMS 1.x.
  • A development environment with write access to the public file system for exports and to the themes/ directory for theme creation.
  • Theme Setup is optional. It is needed locally only when including the library in a newly generated theme, and must be included in a finished theme that uses its setup features.

Install and enable Theme Setup Builder, then navigate to Administration > Configuration > Development > Theme Setup Builder (admin/config/development/theme-setup-builder).

Access is controlled by the Administer Theme Setup Builder permission. Grant this restricted permission only to trusted developers who are authorized to create theme files and export site data.

Development environments only: This module is not recommended for production websites. Exported configuration and content are stored in the public file system. Exports may include unpublished or restricted content and associated files. Do not export sensitive data. Disable the module and remove exported files when they are no longer needed.

Features

The administration interface provides three main tabs:

  • Config: Export selected native Backdrop configuration.
  • Settings Content: Export the additional configuration and sample content used by Theme Setup.
  • Theme Builder: Create a standalone theme or sub-theme, with optional Theme Setup integration.

Theme Builder

Theme Builder creates a starter theme directly from the administration interface.

Enter a theme name, review or edit the automatically generated machine name, enter an optional description, and select a base theme if needed. The base theme list contains locally available themes; use Backdrop's Project Installer to obtain additional base themes.

The following files and directories can be selected:

  • CSS stylesheet (css/)
  • JavaScript file (js/)
  • template.php
  • theme-settings.php
  • Configuration directory (config/)
  • Theme Setup library and sample setup files

The theme's .info file is generated automatically from the selected options. Existing project names are rejected, and existing theme files are not overwritten. Generated themes are not enabled automatically.

For example, a theme created with all options may have the following structure:

themes/
└── my_theme/
    ├── my_theme.info
    ├── DEVELOPMENT.md
    ├── template.php
    ├── theme-settings.php
    ├── css/
    │   └── my_theme.css
    ├── js/
    │   └── my_theme.js
    ├── config/
    ├── includes/
    │   ├── theme-setup.inc
    │   └── theme-setup-form.inc
    └── settings-content/

Optional Theme Setup integration

Install Theme Setup using Project Installer or place it in a supported local themes directory. The example theme does not need to be enabled.

When the required files are available locally, the Include Theme Setup library option becomes available. Selecting it will:

  • Copy theme-setup.inc and theme-setup-form.inc into the new theme's includes/ directory.
  • Copy the sample settings-content/ directory and its supported files and subdirectories.
  • Generate theme-settings.php with the library's default grouped settings form.
  • Add a default setting to the .info file so Backdrop exposes the theme settings page.

Review and replace the copied sample data with the configuration and content appropriate for your theme before distributing it. The Theme Setup documentation explains how to customize the setup options.

The generated theme contains its own copy of the library and does not require Theme Setup Builder or the Theme Setup example theme on the target site. Library files are copied from the local installation, not downloaded automatically.

Development resources

Every generated theme includes a DEVELOPMENT.md file containing useful links to Backdrop theme development documentation, APIs, layout development, debugging, JavaScript, libraries, and theme development tools.

This provides a starting point for designers without adding runtime dependencies to their themes.

How it works

Theme Setup Builder and Theme Setup are separate projects with complementary roles:

Theme Setup Builder is used during development to create themes and export configuration and sample content.

Theme Setup can be included with the finished theme to configure a Backdrop site and import the theme's sample content.

A typical workflow is:

Create a theme using Theme Builder
              ↓
Build and configure a Backdrop demonstration site
              ↓
Export selected configuration and sample content
              ↓
       Exported files
       ├── config/
       └── settings-content/
              ↓
       Add files to the theme
              ↓
       Distribute the theme
              ↓
Theme Setup imports sample data on the target site

Theme Setup Builder can also export configuration and sample content for existing themes without using Theme Builder.

What can be exported

Configuration

Theme Setup Builder can export selected Backdrop configuration using Backdrop's native Configuration Management system (CMI), including:

  • Content types
  • Taxonomy vocabularies
  • Menus
  • Image styles
  • Text formats and editors
  • Custom blocks
  • Views
  • Layouts

Configuration files are exported to:

public://theme_setup_builder/config/

Settings Content

Theme Setup Builder can also generate the additional files used by Theme Setup, including:

  • Required modules
  • Field definitions and field instances
  • Taxonomy terms
  • Menu links
  • Sample content
  • Files and images referenced by exported content

These files are exported under:

public://theme_setup_builder/settings-content/

For example:

settings-content/
├── modules/
│   └── modules.json
├── fields/
├── taxonomy/
│   └── terms.json
├── menu/
│   └── links.json
├── content/
│   └── content.json
└── files/

Only files referenced by the selected sample content are copied during content export. Review the export package before adding it to your theme. Re-exporting replaces the corresponding output files but does not necessarily remove files left by earlier exports.

Copy the exported config/ and settings-content/ files into the corresponding directories of your theme as needed.

Sample content

Sample content can be selected by content type and individual content item.

The exporter supports common Backdrop field types and preserves the information needed by Theme Setup to recreate them, including:

  • Text, long text, and text with summary
  • Numbers, including decimal values
  • Boolean and list fields
  • Link fields
  • Taxonomy term references
  • Entity References to content (nodes)
  • Image and file fields
  • Multi-value fields

Content exports include publication status, promoted and sticky flags, body text and summary, and URL aliases where available.

Entity References to nodes are exported using the referenced content type and title rather than site-specific node IDs. Taxonomy references use the vocabulary and term name rather than site-specific term IDs.

Include referenced content and taxonomy terms in your package unless they already exist on the target site. When exporting hierarchical taxonomy terms, include their parent terms as needed. Only one parent per taxonomy term is supported.

Internal menu links use URL aliases when available. Review links that still use site-specific internal paths before distributing the theme.

Why Theme Setup Builder?

Backdrop CMS provides powerful tools for building content structures, Views, layouts, fields, menus, and other site configuration.

Theme Setup Builder simplifies the development process by reducing repetitive tasks, from creating the initial theme structure to preparing reusable configuration and sample-content files.

Designers can focus on building and customizing their themes through Backdrop's normal interface, while using Theme Setup Builder to prepare configuration and sample content files for inclusion in their themes.

Relationship with Backdrop CMI

Theme Setup Builder does not replace Backdrop Configuration Management.

Configuration that can be handled by Backdrop CMI is exported using the native configuration format.

Theme Setup Builder generates additional files for setup tasks such as sample content, taxonomy terms, menu links, required modules, fields, and referenced files that are handled by Theme Setup.

Related projects

Project status

Theme Setup Builder is under active development. The export workflow and theme creation features, including optional Theme Setup integration and the generated development guide, have been manually tested in a development environment. Automated test coverage and further improvements are planned.

Credits

License

Theme Setup Builder is free and open-source software licensed under the GNU General Public License, version 2 or later (GPL-2.0-or-later).

See LICENSE.txt for the full license text.

About

A lightweight Backdrop CMS module that helps theme designers export site configurations, sample content, and layouts into JSON files for use with the Theme Setup library.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages