CoolCMS API

SettingInitTrait

Table of Contents

Methods

getSettingContext()  : SettingContext
setSettingContext()  : $this
initializeSetting()  : void
Fills the setting context and the template variable `$settings`.

Methods

initializeSetting()

Fills the setting context and the template variable `$settings`.

private initializeSetting() : void

IMPORTANT: the template gets only a subset without secrets. Passing the whole merged map would leave email.smtp.password and cron.token as a Latte variable on every front request, one {$settings|json} away from a leak. Two independent layers cover the two contexts:

  • The front end receives only the public subset from the Api (getPublicMerged), so $settings is public by principle.
  • Admin, Api and Cron keep reading the full getMerged (the admin edits secrets too); SettingSecrecy::stripSecrets() removes them for the template. No admin template reads $settings, and the setting form takes its values from the manager (SettingPresenter::loadSettings()).

settingContext is not narrowed: it is the server working context shared with the Api managers that run in the same request through the bridge (SMTP, appTempDir, emailTemplatePath). See SettingContext.

On this page

Search results