CoolCMS API

ThemeRepository
in package

Table of Contents

Properties

$apiEndpoint  : string
$bridge  : ApiBridge

Methods

__construct()  : mixed
find()  : array<string, string>
Returns the admin theme keys (`theme.admin`, `theme.admin.path`) from module 1.
pick()  : array<string, string>
Picks the given keys from the merged map returned by the endpoint.

Properties

Methods

find()

Returns the admin theme keys (`theme.admin`, `theme.admin.path`) from module 1.

public find(array<int, string> $keys[, array<int, string> $optionalKeys = [] ]) : array<string, string>

The keys are read from the public merged map, not from the entity endpoint: the entity path would hydrate every setting row on each admin request and tie the admin bootstrap to the table schema.

IMPORTANT: Admin\BasePresenter::startup() initializes the theme before authentication, so this call also runs on the anonymous login page. Under enforce the admin-only get-merged endpoint would answer DENY there, the theme would resolve to null and the login page would fail with HTTP 500, so nobody could sign in. That is why theme.admin and theme.admin.path are flagged is_public = 1; they only expose the theme name and asset path, which every admin asset URL shows anyway.

IMPORTANT: only theme keys belong here (called from ThemeMapper::find()). A key added here must be public, otherwise the admin bootstrap silently loses it. The full map, including secrets, comes from SettingRepository.

$optionalKeys may be missing in the database (today theme.admin.skin): they are loaded but do not count toward the completeness check. Otherwise an install without their seed would trigger the useless admin-only fallback on every request, including the anonymous login; a missing optional key just means "no color variant".

Parameters
$keys : array<int, string>
$optionalKeys : array<int, string> = []
Return values
array<string, string> —

key => value

pick()

Picks the given keys from the merged map returned by the endpoint.

private pick(array<int, string> $keys, string $endpoint) : array<string, string>
Parameters
$keys : array<int, string>
$endpoint : string
Return values
array<string, string> —

only the keys the endpoint actually returned

On this page

Search results