Emulate Site Settings module for non admin users

Hello, i would to know what would be the best way to achieve my need, if i’m doing things correctly, or if i can make it more simple.

With TYPO3 14.3, I want my user to be able to manage website logo, baseline, pid of footer menu, stuff like this.
My users are not administrator, so i am not able to use SiteSettings module.

I added a custom table where the user can manage those custom settings, and by using database-query, record-transformation, files, etc. i am able to use those settings in my fluid templates.

  90 = database-query
  90 {
    as = websiteSettings
    table = tx_website_settings
    pidInList.data = site:rootPageId
    max = 1
    dataProcessing {
      10 = record-transformation

      20 = files
      20 {
        references {
          fieldName = brand_operator
        }
        as = brandOperator
      }

      100 = custom-processor
    }
  }

Now there is some settings i want to be able to use in typoscript, to do things like this:

With SiteSettings, i would do

[traverse(site(‘configuration’), ‘settings/theme/default’) !== ‘none’]
config.htmlTag.attributes.data-scheme = {$theme.default}
[END]

Since i’m not using SiteSettings, i made an Event Listener where i listen to SiteConfigurationLoadedEvent.
Inside, i’m retrieving my record with QueryBuilder, and i’m setting configuration accordingly
eg:

$siteConfiguration[‘theme’][‘default’] = $queryResult[‘default_theme’]
$event->setConfiguration($siteConfiguration);

Then i can do in typoscript

[traverse(site(‘configuration’), ‘theme/default’) !== ‘none’]
config.htmlTag.attributes.data-scheme.data = site:theme.default
[END]

Now this is working, but am i doing things right? Could i hook somewhere else in the process, to add what i’m retrieving from database as if it was “true” site settings, so i could use them directly in typoscript?

Thanks for reading me

Hi @namnam!

Welcome back to talk.typo3.org.

Your examples look OK to me. I don’t think there is a right or wrong way to achieve what you’re trying to do.

The example in the documentation for SiteConfigurationLoadedEvent already demonstrates how it can be used to modify the site configuration.

I would make the modified site settings the default way to access your extra settings. The Site object is already included by default in Fluid templates.

Thanks for your opinion Mathias, means a lot to see i’m not going completely on a wrong path.

Before doing this, i looked how camino was made, and i saw for example they choose to extend pages to manage logo, with a comment @todo remove once it is possible to select files in Site Settings

So i know the module will still improve, but the current state is not fitting my needs:

  • no delegation to non admin user.
  • miss some flexibility/functionnality compare to TCA
  • if your sets depends of some other sets, you cannot hide dependencies, all “active” sets appears in the module, you cannot choose to use but hide some sets.
  • if you use site sets to manage “theme” settings, like a baseline you would use on all pages in header, you cannot localize it.

Yes. As you say, the Site Settings are still not feature complete, and I know others have been wishing for a localization feature too. My recommendation would be to stay as close as possible to the core and adapt where you need to.