Xgenious/ docs

Landlord Theme Development

A landlord theme restyles the platform's own public site — the central storefront rendered from core/resources/views/landlord/frontend/**: home, blog, pricing and checkout, auth pages, the user dashboard, payment pages and the docs plugin pages.

It is a separate system from the tenant themes described in Theme Development:

Tenant themeLandlord theme
Locationcore/themes/<slug>/core/landlord-themes/<slug>/
ScopeOne customer websiteThe whole platform (central site)
Activated bytenants.theme_slug (per tenant)landlord_theme_slug central option (one at a time)
Manifesttheme.jsonlandlord-theme.json
Resolutionthemes.<slug>.frontend.* → fallbacks.frontend.*landlord.frontend.* → core resources/views
Assetsassets/tenant/frontend/themes/… + theme routes/landlord-theme-assets/<slug>/<path>
Admin pageThemes → All Themes (tenant catalog)Themes → Landlord Site Theme
CheckerThemeCompatibilityCheckerLandlordThemeCompatibilityChecker
Note

The two trees never overlap. Installing or activating a landlord theme cannot change a tenant website, and a tenant theme cannot change the platform site. With no landlord theme active the storefront renders core views exactly as before — the feature is purely additive.

Where landlord themes live

core/landlord-themes/<slug>/
├── landlord-theme.json              # manifest (required)
├── views/landlord/frontend/…        # only the files you override
│   ├── frontend-page-master.blade.php
│   ├── partials/header.blade.php
│   └── partials/footer.blade.php
├── assets/
│   ├── css/acme.css
│   ├── js/acme.js
│   └── img/…
├── screenshot/primary.jpeg          # optional; card artwork
└── README.md

A copy-paste scaffold ships with the platform:

  • core/landlord-themes/_starter/ — folders starting with _ are ignored by discovery, so it can never be activated by accident.

How a view is resolved

At boot — after every provider has booted, so a plugin that registers a theme in its own boot() is included — the active theme's views/ root is prepended to Laravel's file view finder:

app('view')->getFinder()->prependLocation($themeViewRoot);

The consequences:

  • landlord.frontend.partials.header resolves to the theme file when the theme ships it.
  • Every file the theme does not ship falls back to core/resources/views/landlord/frontend/... automatically. Themes are overlays, not copies.
  • No controller, core view or plugin view needs to change.
  • Plugin views that @extends('landlord.frontend.frontend-page-master') or @extends('landlord.frontend.user.dashboard.user-master') — Documentation, DomainReseller, ToltAffiliate — are themed automatically.

For code that wants to be explicit:

return landlord_theme_view('landlord.frontend.blog.category', compact('all_blogs'));

landlord_theme_resolver() exposes the same lookup:

MethodReturns
viewRoot()Absolute path prepended to the finder, or null for core
paths()Priority-ordered view roots (theme → filtered extras → core)
themeFile('landlord.frontend.partials.header')Absolute path or null
hasOverride($view)bool
asset('css/acme.css')Public URL or null
assetUrls('css' | 'js')Manifest asset URLs for the active theme
Warning

Only Blade files under views/landlord/ are accepted in an uploaded package. A theme can shadow the landlord storefront — never tenant views, admin screens or shared x-ui.* components.

Page templates and datasets

A theme can ship complete pages, not only overrides. A file at views/landlord/frontend/pages/<slug>.blade.php is rendered by the landlord catch-all route for that slug — even when no Page row exists:

views/landlord/frontend/pages/features.blade.php   → /features
views/landlord/frontend/pages/pricing.blade.php    → /pricing
views/landlord/frontend/pages/about.blade.php      → /about

Pages that need platform data declare it in the manifest and receive resolved variables, so the theme itself never queries the database:

"pages": {
    "home":          { "data": ["themes", "plans"] },
    "templates":     { "data": ["themes"] },
    "pricing":       { "data": ["plans"] },
    "resources":     { "data": ["posts"] },
    "documentation": { "data": ["docs"] }
}
DatasetVariablesSource
themes$themes, $theme_categoriesPublished tenant themes + the manifest's template_categories map
plans$plans, $plan_typesActive price plans grouped by monthly / yearly / lifetime
posts$posts, $post_categoriesPublished landlord blog posts (paginated)
docs$docs_categories, $docs_articlesDocumentation plugin categories and articles

$page_post is always present (the Page row, or null for a theme-only page). Extend the payload with the landlord_theme_page_data filter:

add_filter('landlord_theme_page_data', function (array $data, string $slug) {
    if ($slug === 'pricing') {
        $data['annual_discount'] = 20;
    }

    return $data;
}, 10, 2);

template_categories groups themes on /templates and the home page:

"template_categories": {
    "construction": { "label": "Construction", "themes": ["construction", "construction-teal"] },
    "hotels": { "label": "Hotels", "themes": ["hotel-booking"] }
}
Tip

core/landlord-themes/natting is a complete reference: 16 page templates (home, features, templates, pricing, resources, documentation, about, contact, affiliate, legal pages, login and registration), real themes/plans/posts/docs data, and the full Natting design system in assets/css/natting.css.

Manifest contract

landlord-theme.json must be valid JSON at the theme root.

{
    "slug": "acme",
    "name": "Acme",
    "version": "1.0.0",
    "author": "Acme Inc",
    "description": "Conversion-focused platform storefront.",
    "scope": "landlord",
    "origin": "third-party",
    "assets": {
        "css": ["css/acme.css"],
        "js": ["js/acme.js"]
    },
    "tokens": {
        "main-color-one": "#0ea5e9",
        "main-color-one-rgb": "14, 165, 233"
    }
}
KeyRequiredNotes
slugyesFolder name, [A-Za-z0-9][A-Za-z0-9._-]*
nameyesCatalog title
versionyesDisplayed on the card
authornoDisplayed on the card
descriptionnoRecommended
scopenoDocumentation only; landlord is implied
originnocore shows a “Core” badge; anything else “Third-party”
assets.css / assets.jsnoPaths relative to the theme's assets/
tokensnoCSS variable overrides (see below)

A plugin can register a theme at runtime instead of shipping a package folder:

add_filter('landlord_themes', function (array $themes) {
    $themes['acme'] = (object) [
        'slug'  => 'acme',
        'name'  => 'Acme',
        'version' => '1.0.0',
        '_path' => plugin_path('Acme').'/landlord-theme', // optional
        'tokens' => ['main-color-one' => '#0ea5e9'],
    ];

    return $themes;
}, 10);

Design tokens

The :root block that used to be inline in landlord/frontend/partials/color-font-variable.blade.php is now produced by landlord_theme_tokens_css(). It is layered:

  1. current site settings (main_color_one, heading_color, heading_font_family, …) — the previous hardcoded defaults,
  2. the active theme's manifest tokens,
  3. apply_filters('landlord_theme_tokens', $tokens, $theme),
  4. apply_filters('landlord_theme_tokens_css', $css, $tokens).
add_filter('landlord_theme_tokens', function (array $tokens, ?object $theme) {
    $tokens['main-color-one'] = '#0ea5e9';
    $tokens['main-color-one-rgb'] = '14, 165, 233';
    $tokens['radius-lg'] = '14px';

    return $tokens;
}, 10, 2);

// Escape hatch: replace the whole block.
add_filter('landlord_theme_tokens_css', fn (string $css) => $css."\n:root{--acme-glow:0 0 24px rgba(14,165,233,.4)}");

Keys are the CSS variable names with or without the leading --. Anything the previous inline block emitted (--main-color-one, --main-color-two, --heading-color, --header-bg-color, --footer-bg-color, --paragraph-color*, --heading-font, --body-font, …) is available.

Assets

Files under the theme's assets/ folder are served by the platform, never copied into core/public/assets:

landlord_theme_asset('css/acme.css');  // → /landlord-theme-assets/acme/css/acme.css?v=…
landlord_theme_asset_urls('css');      // manifest + landlord_frontend_styles
landlord_theme_asset_urls('js');       // manifest + landlord_frontend_scripts
  • Route: landlord.theme.asset (/landlord-theme-assets/{slug}/{path}).
  • Response: correct MIME type, Cache-Control: public, max-age=31536000, immutable, X-Content-Type-Options: nosniff.
  • Path traversal and symlink escapes are rejected (404).
  • The header injects CSS assets after core styles; the footer injects JS assets before @yield('scripts').
Tip

Add third-party CSS/JS from a plugin with the filters instead of editing the manifest:

add_filter('landlord_frontend_styles', fn (array $urls) => array_merge($urls, [
    asset('plugin-assets/acme.css'),
]));

Hook and filter surface

All landlord theme tags are registered in App\Services\Hook\MandatoryHooks and covered by php artisan hook:audit. The complete list is also in the Hooks Reference.

Registry and resolver

TagTypePayload
landlord_themesfilter(array $themes) — register a manifest object
landlord_theme_active_slugfilter(?string $slug) — force a theme without writing the DB
landlord_theme_view_pathsfilter(array $paths) — view roots in priority order
landlord_theme_tokensfilter(array $tokens, ?object $theme)
landlord_theme_tokens_cssfilter(string $css, array $tokens)

Chrome

TagTypeFires in
landlord_frontend_html_attributesfilter<html> — (string $attributes)
landlord_frontend_body_classfilter<body> — (string $classes)
landlord_frontend_titlefilter<title> — (string $title, $page_post)
landlord_frontend_metaactionHeader, before </head>
landlord_frontend_stylesfilterHeader CSS list — (array $urls)
landlord_frontend_scriptsfilterFooter JS list — (array $urls)
landlord_frontend_head / frontend_headactionBefore </head>
landlord_frontend_headeractionAfter <body>
landlord_frontend_before_navbar / landlord_frontend_after_navbaractionAround the navbar
landlord_frontend_nav_itemsfilterNavbar <ul> HTML — (string $html, $menu)
landlord_frontend_nav_actionsactionNavbar right column
landlord_frontend_before_footer_widgets / landlord_frontend_after_footer_widgetsactionAround footer widgets
landlord_frontend_footer_columnsfilterFooter widget row HTML
landlord_frontend_footer / frontend_footeractionBefore </body>

Content

TagTypePayload / location
landlord_frontend_before_content / landlord_frontend_after_contentactionAround @yield('content') in every page
landlord_frontend_page_titlefilter(string $title, $page_post)
landlord_frontend_breadcrumbfilter(array $crumbs, $page_post) — [['label' => …, 'url' => …], …]
landlord_frontend_breadcrumb_htmlfilter(string $html, array $crumbs) — non-empty replaces the markup
landlord_frontend_home_before_sections / landlord_frontend_home_after_sectionsactionfrontend-home — ($page_post)
landlord_frontend_blog_cardfilter(string $html, $post) — each card in category/search/tag listings
landlord_frontend_blog_single_before / landlord_frontend_blog_single_afteractionBlog single — ($blog_post)

Worked examples

// Add a status link to the main navigation without touching core.
add_filter('landlord_frontend_nav_items', function (string $html, $menu) {
    return $html.'<li><a href="/status">'.__('Status').'</a></li>';
}, 10, 2);

// Announce a launch above the page content.
add_action('landlord_frontend_before_content', function () {
    echo '<div class="alert alert-info">'.__('New pricing is live.').'</div>';
});

// Replace the breadcrumb with a schema-friendly version.
add_filter('landlord_frontend_breadcrumb_html', function (string $html, array $crumbs) {
    if (empty($crumbs)) {
        return $html;
    }

    return view('acme::breadcrumb', compact('crumbs'))->render();
}, 10, 2);

Page Builder compatibility

The theme layout and the Page Builder coexist. A Page row with page_builder = 1 renders the builder content inside the themed layout (header, footer, tokens, theme CSS/JS), and every registered landlord widget/addon works unchanged — e.g. /pricing-plan, /all-templates and /blogs on a default install.

Designed pages default to static. Switch any page to the builder in the manifest:

{
    "page_mode": "static",
    "pages": {
        "home":     { "data": ["themes", "plans"], "mode": "auto" },
        "features": { "mode": "static" },
        "about":    { "mode": "builder" }
    }
}
ModeBehaviour
static (default)The designed template renders; builder content is ignored for that slug
auto / builderBuilder content wins when the Page row is builder-driven; otherwise the designed template (or normal page content) is used

frontend-home.blade.php receives $use_page_builder for the same decision. The Natting theme ships page_mode: static; flip it to auto to edit the home and pages in the builder instead of the designed templates. Refresh discovery after editing the manifest (landlord_theme_manager()->clearCache(); a plain cache:clear may not clear the file store discovery uses).

Note

Themes are presentation-only and cannot register Page Builder widgets. To make a bespoke design editable section-by-section, ship the widgets as a companion plugin (BaseWidget subclasses) — the generic landlord widgets (header slider, price plans, template grid, FAQ, newsletter, …) are already available and inherit the theme's design tokens.

Reference addon plugin

core/plugins/NattingLandlord shows the pattern: 11 landlord widgets (ntt_hero, ntt_features, ntt_templates, ntt_pricing, ntt_video, ntt_faq, ntt_newsletter, ntt_page_hero, ntt_doc_topics, ntt_doc_popular, ntt_cta_band) that render the theme's landlord.frontend.sections.* partials, so the builder output is identical to the designed page.

php artisan natting:seed-home          # builder-driven home (home_page option)
php artisan natting:seed-home --no-activate
php artisan natting:seed-docs          # builder-driven /documentation

The Natting theme ships pages.home.mode and pages.documentation.mode as auto; the remaining designed pages stay on their theme templates until their mode flips. Builder widgets render in the frontend with the theme layout, and appear under the Theme category in the page-builder panel.

Build a theme in five steps

  1. Copy the scaffold.

    cp -R core/landlord-themes/_starter core/landlord-themes/acme
    
  2. Set the manifest. Change slug to acme, then add your CSS/JS and token overrides in landlord-theme.json.

  3. Override only what changes. Copy a single core file into the theme:

    mkdir -p core/landlord-themes/acme/views/landlord/frontend/partials
    cp core/resources/views/landlord/frontend/partials/header.blade.php \
       core/landlord-themes/acme/views/landlord/frontend/partials/header.blade.php
    

    Keep every landlord_* hook call in the copy. The upload checker rejects a header/footer/layout that dropped them.

  4. Install and activate it. Landlord Admin → Themes → Landlord Site Theme → upload the zip (or FTP the folder into core/landlord-themes/ and run php artisan cache:clear), then click Activate.

  5. Verify.

    php artisan hook:audit --verbose
    php artisan view:clear
    

    Visit /, /blog, a blog post, /view-plan/{id}, /plan-order/{id}, /login and /user-home, in both LTR and RTL.

Installing, activating and resetting

Landlord Admin → Themes → Landlord Site Theme (/admin-home/site-theme, routes landlord.admin.site.theme, .activate, .upload).

  • Upload a .zip containing landlord-theme.json, views/landlord/** and optionally assets/** and screenshot/primary.*.
  • The Core Layout card is always present. Use Core Layout clears landlord_theme_slug and returns the platform to core views.
  • Activation is platform-wide, one theme at a time.
  • Discovery is cached (landlord_theme_manager.discover, 60 s in local, 1 h otherwise). The admin actions and uploads invalidate it; a manual FTP drop needs php artisan cache:clear.

Under the hood:

landlord_theme_manager()->discover();      // cached registry
landlord_theme_manager()->all();           // slug ⇒ manifest
landlord_theme_manager()->find('acme');
landlord_theme_manager()->active();        // ?object
landlord_theme_manager()->activeSlug();    // ?string
landlord_theme_manager()->activate('acme');       // true|false
landlord_theme_manager()->activate(null);         // back to core
landlord_theme_manager()->screenshot('acme');     // ?string
landlord_theme_manager()->clearCache();

A stale or deleted slug falls back to the core layout instead of erroring. A broken registry/filter callback is reported and the storefront keeps rendering.

Package compatibility checks

App\Services\Upload\LandlordThemeCompatibilityChecker runs before a package is written to core/landlord-themes/.

Errors (upload blocked):

  • landlord-theme.json missing, unreadable or invalid JSON.
  • Missing name, slug or version; invalid slug.
  • Path traversal, .env, vendor/, node_modules/, .git/.
  • PHP syntax errors in shipped .php files.
  • Any .blade.php outside views/landlord/.
  • DB::, the DB facade, Schema::, or route definitions (Route::get/post/group/resource/…) inside a template.
  • An overridden chrome file that dropped its mandatory hooks.

Warnings (install allowed):

  • Folder name or zip filename disagreeing with slug.
  • A theme with the same slug already installed (it is overwritten).
  • tokens / assets with the wrong shape.
  • A copy of core that contains core's own model/controller reads (a theme copying the user dashboard legitimately does).
  • Missing screenshot/primary.* — the card falls back to an icon.

Mandatory hooks per overridden file:

FileMust contain
views/landlord/frontend/partials/header.blade.phplandlord_frontend_head, landlord_frontend_header
views/landlord/frontend/partials/footer.blade.phplandlord_frontend_footer, frontend_footer
views/landlord/frontend/frontend-page-master.blade.phplandlord_frontend_before_content, landlord_frontend_after_content
views/landlord/frontend/user/dashboard/user-master.blade.phplandlord_user_dashboard_menu_items, landlord_user_dashboard_menu

Debugging

# Theme registry and every emitter
php artisan hook:audit --verbose

# Confirm resolution without activating anything
php artisan tinker
>>> landlord_theme_resolver()->themeFile('landlord.frontend.partials.header');
>>> landlord_theme_resolver()->viewRoot();

# Force a theme for one request (does not touch the database)
php artisan tinker
>>> add_filter('landlord_theme_active_slug', fn () => 'natting');
Tip

Because resolution is a view-finder location, a stale compiled view is the usual culprit after switching themes: run php artisan view:clear. Theme CSS is versioned with ?v=<mtime> — hard-refresh the browser if a stylesheet looks cached.

Warning

Prefer hooks and tokens over copying a whole template. A copied file stops receiving core fixes: if a future release adds a hook to partials/header.blade.php, your copy will not fire it until you re-sync. Ship only the files you actually change.

See also

Still stuck?
Our support team is ready to help you get set up.
Get support