Skip to content

refactor!: configure default template in code instead of rex_config#6535

Merged
gharlan merged 3 commits into
6.xfrom
refactor/template-default
May 31, 2026
Merged

refactor!: configure default template in code instead of rex_config#6535
gharlan merged 3 commits into
6.xfrom
refactor/template-default

Conversation

@gharlan
Copy link
Copy Markdown
Member

@gharlan gharlan commented May 31, 2026

Why

Templates are code (not DB) since 6.x, so the default template no longer belongs in rex_config. The default_template config setting and its backend dropdown in the system settings have become inconsistent with that model.

What

  • Replace the default_template config setting with Template::setDefault(MyTemplate::class), meant to be called in the project's boot() method. It takes the FQCN (autocomplete-friendly) and throws if the class is not a registered template.
  • Template::getDefaultKey() returns the key of the configured default; when none is set it falls back to the first available template — which covers the common case of a single template nicely. Returns null only when no templates exist at all.
  • Remove the default_template setting handling and the select field from pages/system/settings.php plus the related lang strings.
  • Simplify the now-redundant fallback logic in CategoryHandler (the per-category fallback stays, since the global default may not be allowed in a given category).

Breaking change

The default_template config key and its system setting UI are gone. Projects must set their default template in code via Template::setDefault(...) instead.

Templates are code (not DB) since 6.x, so the default template no longer
belongs in rex_config. Replace the "default_template" config setting and its
backend dropdown with Template::setDefault(MyTemplate::class), to be called in
the project boot() method. When no default is set, the first available template
is used.
@gharlan gharlan added this to the REDAXO 6.0 milestone May 31, 2026
@gharlan gharlan merged commit f3540ed into 6.x May 31, 2026
16 checks passed
@gharlan gharlan deleted the refactor/template-default branch May 31, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants