Context

What the $ctx array contains

KeyTypeUse
title, subtitlestringPage title and subtitle.
activestringActive navigation item.
actionsstringHTML actions block pre-rendered by the core.
flasharray|nullOptional flash message.
userarray|nullCurrent user.
theme_idstringActive theme identifier.
app_name, app_logo_letterstringInstance identity.
navarrayNavigation already filtered by permissions.

Inside an overridden page, you may also receive page_id and data. For the dashboard, data currently contains the summary loaded by the core.

Theme API

Template tags to prefer

  • rui_current_user(), rui_can(), rui_can_restore()
  • rui_app_name(), rui_app_logo_letter(), rui_theme_id()
  • rui_nav(), rui_route(), rui_escape()
  • rui_part(), rui_slot(), rui_default_slot()
  • rui_dashboard_summary(), rui_list_repos(), rui_list_hosts(), rui_list_users()

These helpers are exposed by src/ThemeTemplateTags.php. They offer a more stable surface than direct calls to the database, internal managers or objects that were not designed for themes.

Best practices

Composing a theme without making it fragile

  • Prefer a part override over a full slot copy when possible.
  • Use rui_default_slot() to wrap native rendering when that is enough.
  • Escape dynamic output with rui_escape() or existing helpers.
  • Avoid business logic and direct access to internal layers from theme templates.
Treat internal classes as core implementation details, not as a stable API for themes. The safest way to avoid regressions is to go through the context and template tags.