Skip to content

Helper & template reference

Every helper and Blade directive a Salieno theme uses — signatures, return values, and copy-pasteable examples.

7 min readUpdated Aug 13, 2026
On this page

Helper & template reference#

This is the reference for every global helper a theme calls, plus the Blade directives your views rely on. All of these are plain PHP functions registered in app/Helpers/helpers.php; the theme-specific ones proxy to App\Services\Helpers\ThemeHelper. You can call any of them from a Blade view or an inline @php block without importing anything.

Everything below is verified against the reference salieno theme and the Core helper classes. Where a function has been renamed, the old name still works — see Deprecated aliases.

Resolution helpers#

These turn "the active theme" into concrete view names and asset URLs. The active theme is whatever the operator has stored (session('template') ?? gs('active_theme')); it is the empty string when no theme is installed, which is how the neutral Core holding page gets rendered. See Theme overview for the full resolution story.

HelperReturnsExample
activeTheme(bool $asset = false)"themes.{name}." — or "assets/themes/{name}/" when $asset is trueactiveTheme()"themes.salieno."
activeThemeName()The bare theme name as a string, or '' when none is activeactiveThemeName()"salieno"
themeViewName(string $view)The dotted view name for the active theme: "themes.{name}.{view}"themeViewName('auth.login')"themes.salieno.auth.login"
themeAsset(string $path)Public URL for a published asset, with a ?v=<mtime> cache-buster appendedthemeAsset('css/theme.css')/assets/themes/salieno/css/theme.css?v=1737000000

activeTheme() is the string you concatenate in Blade directives that need a view prefix:

blade
@extends(activeTheme() . 'layouts.frontend')
@include(activeTheme() . 'partials.render-sections', ['sections' => $sections])

themeViewName() is what controllers and Livewire components pass to view() — you rarely call it from a view yourself, but it is the canonical way to name a theme view in PHP:

php
return view(themeViewName('home'));

themeAsset() is the only correct way to reference your own CSS/JS/images. It resolves to public/assets/themes/{name}/… and stamps the file's modification time onto the URL so a republished asset is never served stale from cache. Never hardcode /assets/themes/... paths. Full detail in CSS, JavaScript & images.

blade
<link rel="stylesheet" href="{{ themeAsset('css/theme.css') }}">
<script src="{{ themeAsset('js/theme.js') }}" defer></script>
<img src="{{ themeAsset('images/hero.svg') }}" alt="">

Manifest & metadata#

themeMeta() reads your theme.json runtime manifest (cached, keyed on the file's mtime). Pass a dotted key to reach into nested objects like colors or supports.

HelperReturnsExample
themeMeta(?string $key = null, $default = null)The value at $key from theme.json, $default if absent; the whole array when $key is nullthemeMeta('version')"1.2.0"
blade
{{-- Read a declared brand colour with a safe fallback --}}
<meta name="theme-color" content="{{ themeMeta('colors.primary', '#000000') }}">

{{-- Gate a feature on a manifest flag --}}
@if(themeMeta('supports.dark_mode'))
    @include(activeTheme() . 'partials.mode-switcher')
@endif

The manifest fields themselves (name, version, colors, supports, settings, …) are documented in Theme anatomy & the two manifests.

Editable content (the page builder)#

Section blades read admin-edited content out of the Frontend table, scoped to the active theme's name. getContent() is the accessor; the companions describe the page's section layout.

HelperReturnsNotes
getContent(string $key, bool $singleQuery = false, ?int $limit = null, bool $orderById = false)A single Frontend model when $singleQuery is true, otherwise a CollectionFilters on the active theme + data_keys = $key; $limit caps a collection; $orderById sorts ascending by id (default is newest-first)
getPageSections(bool $asArray = false)The decoded sections.json (object by default, array when $asArray is true)Cached for 24h per theme
getCategorySection(string $sectionKey)A ServiceCategory (with active products + pricing) for a category_detail_{id} slug, else nullUsed by dynamically generated category sections

Convention: a section's editable fields live under {slug}.content (a single record with a data_values object), and repeatable rows live under {slug}.element (a collection). Always fall back to a hardcoded default so the section renders on a fresh install before anyone opens the builder:

php
@php
    // Single content record → read fields off ->data_values
    $c        = getContent('hero.content', true);
    $heading  = trim((string) (@$c->data_values->heading ?? '')) ?: 'Fast, honest hosting';
    $subhead  = trim((string) (@$c->data_values->subheading ?? '')) ?: 'Deploy in minutes.';

    // Repeatable rows → a collection; each row exposes ->data_values too
    $items = getContent('hero.element');
    $rows  = ($items && count($items) > 0)
        ? $items->toArray()
        : [['title' => 'Uptime', 'description' => '99.99% measured, not promised.']];
@endphp

getPageSections() returns the ordered section catalog defined by your theme's sections.json — see Building sections for the render pipeline and the manifest shape.

Site settings, logo & images#

These read operator-configured settings and stored files — they are not theme-specific, but every theme uses them for the logo, favicon, and brand name.

HelperReturnsExample
gs($key = null)A general-settings value by key, or the whole settings object when $key is nullgs('site_name')"Salieno"
siteLogo($type = null)URL of the uploaded logo (cache-busted); pass 'dark' for the dark-background variant (falls back to the light logo if none)siteLogo('dark')
siteFavicon()URL of the uploaded favicon, cache-bustedsiteFavicon()
getImage(string $path, ?string $size = null)asset($path) when the file exists under public/, otherwise a placeholder/default imagegetImage('assets/images/frontend/x.png')
getFilePath(string $key)The public sub-directory for a stored asset category (logo, favicon, frontend, …)getFilePath('frontend')"assets/images/frontend"
blade
<a href="{{ route('home') }}" class="site-brand">
    <img src="{{ siteLogo() }}" alt="{{ gs('site_name') }}" class="dark:hidden">
    <img src="{{ siteLogo('dark') }}" alt="{{ gs('site_name') }}" class="hidden dark:block">
</a>

<link rel="icon" href="{{ siteFavicon() }}">

Note getImage() and getFilePath() deal in operator-uploaded files under public/assets/images/... — they are distinct from themeAsset(), which serves files you ship inside your theme. Use themeAsset() for your own artwork and getImage()/siteLogo() for whatever the operator uploaded.

Translation#

Theme copy should be translatable. Use Laravel's __() (or the @lang directive) so operators can localise your strings and so getContent() fallbacks respect the active locale. Every hardcoded default string in the reference theme is wrapped in __().

HelperReturnsExample
__(string $key, array $replace = [])The translated string (or the key itself when no translation exists)__('Add to cart')
@lang('...')Blade directive equivalent of __()@lang('Sign in')
blade
<button type="submit">{{ __('Create account') }}</button>
<p>{{ __('Welcome back, :name', ['name' => $user->name]) }}</p>

Blade directives themes rely on#

Your views are ordinary Blade, but a few directives carry theme-specific conventions.

DirectivePurpose
@extends(activeTheme() . 'layouts.frontend')Inherit your public page shell. Pages extend the theme layout, never a hardcoded name.
@section('content') … @endsectionFill the layout's content slot.
@yield('app') / @yield('content')In a layout, the placeholder a child view fills.
@include(activeTheme() . 'partials.x')Pull in a partial. Throws if the partial is missing.
@includeIf(activeTheme() . 'sections.' . $slug)Tolerant include — a missing/renamed slug is skipped, not fatal. This is how the section loop stays resilient.
@stack('style') / @stack('script')In the layout <head>/footer, render everything pushed to that stack.
@push('style') … @endpushFrom any view or section, append page-specific CSS/JS to a layout stack.

The layout defines the stacks; a page or section pushes into them so per-page assets land in the right place without editing the layout:

blade
{{-- In layouts/app.blade.php --}}
<head>
    @stack('style-lib')
    @stack('style')
</head>
<body>
    @yield('app')
    @stack('script-lib')
    @stack('script')
</body>
blade
{{-- In a page or section that needs an extra stylesheet --}}
@push('style')
    <link rel="stylesheet" href="{{ themeAsset('css/pricing.css') }}">
@endpush

The layout structure itself — layouts/app.blade.php, the frontend wrapper, and the Livewire slot bridge — is covered in Layouts and the page shell.

Deprecated aliases#

An earlier generation of themes used template-prefixed names. They were a published API, so they were kept as thin wrappers that delegate to the current names — every one of these still works, but *new themes should use the `theme` names**.

DeprecatedUse instead
activeTemplate(bool $asset = false)activeTheme(bool $asset = false)
activeTemplateName()activeThemeName()
templateViewName(string $view)themeViewName(string $view)
templateAsset(string $path)themeAsset(string $path)
templateMeta(string $key, $default = null)themeMeta(?string $key = null, $default = null)

You will still see activeTemplate() throughout the reference theme's Blade because that theme predates the rename; treat it as equivalent to activeTheme(). In your own theme, prefer the canonical spelling — the behaviour is identical, and the deprecated forms exist only so older marketplace themes don't fatal on a Core update.

Next#

With the helper vocabulary in hand, continue to Colours, dark mode & the mode switcher to wire up your palette and the light/dark toggle.

helpersreferencebladetheme-development
Was this article helpful?
Still stuck?Contact support
Helper & template reference · Salieno Docs