benjaminkott / bootstrap_package

Bootstrap Package delivers a full configured theme for TYPO3, based on the Bootstrap CSS Framework.
https://www.bootstrap-package.com/
MIT License
336 stars 202 forks source link

Overwriting page.logo.normal dynamically depending on site configuration #1101

Open Moongazer opened 2 years ago

Moongazer commented 2 years ago

I try to overwrite the page logo dynamically depending on the site-configuration (each site has a defined tx_myext_organization record which itself holds various information such as a logo):

lib.organizationLogo = FILES
lib.organizationLogo {
  references {
    table = tx_myext_organization
    uid.data = site:myOrganizationUid
    fieldName = logo_original
  }
  renderObj = TEXT
  renderObj {
    data = file:current:publicUrl
  }
}
page.10.dataProcessing.1553883874.files.normal = lib.organizationLogo
page.10.variables.test < lib.organizationLogo

Not sure if the BK2K\BootstrapPackage\DataProcessing\StaticFilesProcessor is the problem here, but file.normal contains the string "lib.organizationLogo" during debugging instead of the file URL, so it seems the expression is not evaluated (also normal.data = ... does not work). Printing the test variable in Fluid contains the correct file URL.

Can someone relate to this issue?

gilbertsoft commented 2 years ago

Why don't you just do it like shown at www.sitepackagebuilder.com?

######################
#### DEPENDENCIES ####
######################
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TypoScript/constants.typoscript">

############
### PAGE ###
############
page {
    logo {
        file = EXT:my_sitepackage/Resources/Public/Images/logo.svg
        fileInverted = EXT:my_sitepackage/Resources/Public/Images/logo-inverted.svg
        height = 52
        width = 192
        alt = My Sitepackage
        linktitle = My Sitepackage
    }
    favicon {
        file = EXT:my_sitepackage/Resources/Public/Icons/favicon.ico
    }
    fluidtemplate {
        layoutRootPath = EXT:my_sitepackage/Resources/Private/Layouts/Page/
        partialRootPath = EXT:my_sitepackage/Resources/Private/Partials/Page/
        templateRootPath = EXT:my_sitepackage/Resources/Private/Templates/Page/
    }
}

So instead of overwrite the setup I would start with the constants in the first place. Or even better create a Sitepackage for each site!

Moongazer commented 2 years ago

Using the constants would mean to define/maintain everything twice, the logo inside the global organization record (which is needed anyway for other reasons) and in the related template defined in the site-tree/root. If we could use the logo from the record, this would simplify things. Is TypoScript not made for such things to easily overwrite predefined configs/structures?

Our use-case is to have one extension (sitepackage) and multiple sites, one site for each organization. It was on purpose NOT having multiple sitepackages for each organization.

Edit: There are even more problems using TypoScript constants: