#### Configuration typoscript des sites

# **** Options de debug ****
[applicationContext == Development*]
    config.debug = 1
    config.contentObjectExceptionHandler = 0
    config.no_cache = 1
    config.admPanel = 0

    plugin.tx_vhs.settings.debug = 0
    plugin.tx_vhs.settings.asset.debug = 0
[end]

[applicationContext == Testing*]
    config.debug = 1
[end]

config.contentObjectExceptionHandler = 0

# **** Configuration générale ****
config.language = fr
config.locale_all = fr_FR.utf-8
config.concatenateCss = 1
config.compressCss = 1
config.compressJs = 1
config.no_cache = 1

# Important: if the filenames are not hashed, it ends up breaking the filename's length limit!
plugin.tx_vhs.assets.mergedAssetsUseHashedFilename = 1

# Add the favicon
page.shortcutIcon = EXT:ot_templating/Resources/Public/Icons/favicon.ico

# **** Déclaration des plugins
lib.auth = USER
lib.auth {
    userFunc = Opentalent\OtConnect\OtAuthenticationService->logout
}

# Overrides fluid_styled_content contents (builtin contents)
#lib.contentElement.templateRootPaths.10 = EXT:ot_templating/Resources/Private/Templates/Ext/fluid_styled_content/Default/Templates/


# **** Page: configuration générale de la page courante ****
page = PAGE
page {
    typeNum = 0
    5 = USER
    5 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = Flux
        vendorName = FluidTYPO3
        pluginName = Page
    }
    10 >
}

page.config.doctype=html5
page.meta {
    keywords.field = keywords
    description.field = description
    author.field = author
    robots = index,follow,archive
    viewport = width=device-width
}

# **** Configuration des extensions ****
plugin.tx_flux {
#    Allow pages which have is_siteroot = 1 to inherit chosen template from parent.
#    Disable this to prevent subsites in a multisite environment from using the same template as the immediate parent of that site root.
    siteRootInheritance = 0
}

plugin.tx_ottemplating {
    view {
        templateRootPaths.0 = {$templateRootPath}
        partialRootPaths.0 = {$partialRootPath}
        layoutRootPaths.0 = {$layoutRootPath}
    }
    settings {
        opentalentWebsite = {$plugin.tx_ottemplating.settings.opentalent.website}
        opentalentLogoPath = {$plugin.tx_ottemplating.settings.opentalent.logoPath}
        opentalentFileStorageUrl = {$plugin.tx_ottemplating.settings.opentalent.fileStorageUrl}
        opentalentDashboardUrl = {$plugin.tx_ottemplating.settings.opentalent.dashboardUrl}
        opentalentLogoutUrl = {$plugin.tx_ottemplating.settings.opentalent.logoutUrl}
        structureId = {$plugin.tx_ottemplating.settings.organization.id}
        structureLogoId = {$plugin.tx_ottemplating.settings.organization.logoid}
        structureName = {$plugin.tx_ottemplating.settings.organization.name}
        structureEmail = {$plugin.tx_ottemplating.settings.organization.email}
        structureIsNetwork = {$plugin.tx_ottemplating.settings.organization.is_network}
        networkLogo = {$plugin.tx_ottemplating.settings.network.logo}
        networkName = {$plugin.tx_ottemplating.settings.network.name}
        networkUrl = {$plugin.tx_ottemplating.settings.network.url}
        cmfUrl = {$plugin.tx_ottemplating.settings.network.cmfUrl}

        # aliases
        organizationId = {$plugin.tx_ottemplating.settings.organization.id}
        organizationIsNetwork = {$plugin.tx_ottemplating.settings.organization.is_network}

        # computed
        structureLogoUrl = {$plugin.tx_ottemplating.settings.opentalent.fileStorageUrl}{$plugin.tx_ottemplating.settings.organization.logoid}/0x60
        networkLogoUrl = /typo3conf/ext/ot_templating/Resources/Public/media/{$plugin.tx_ottemplating.settings.network.logo}

        # Default values for flux parameters
        template = Classic
        themeColor = light-blue
        displayCarousel = {$plugin.tx_ottemplating.settings.appearance.carousel}
        staticDonors = {$plugin.tx_ottemplating.settings.donors.static}
        eventsLimit = {$plugin.tx_ottemplating.settings.events.limit}
        eventsPeriod = {$plugin.tx_ottemplating.settings.events.period}

    }
}

# * Form extension
# @see https://docs.typo3.org/c/typo3/cms-form/9.5/en-us/Introduction/Index.html

# -- BE integration
module.tx_form {
    settings {
        yamlConfigurations {
            100 = EXT:ot_templating/Configuration/Form/CustomFormSetup.yaml
        }
    }
}

# -- FE integration
plugin.tx_form {
    settings {
        yamlConfigurations {
            100 = EXT:ot_templating/Configuration/Form/CustomFormSetup.yaml
        }
        formDefinitionOverrides {
            ContactForm {
                finishers {
                    0 {
                        options {
                            recipientAddress = {$plugin.tx_ottemplating.settings.organization.email}
                        }
                    }
                }
            }
        }
    }
}

# Create the form object to render with:
#     <f:cObject typoscriptObjectPath="lib.tx_ottemplating.widgets.contact"/>
lib.tx_ottemplating.widgets.contact = USER_INT
lib.tx_ottemplating.widgets.contact {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = Form
    pluginName = Formframework
    vendorName = TYPO3\CMS
    switchableControllerActions {
        FormFrontend {
            1 = perform
        }
    }
    settings.persistenceIdentifier = EXT:ot_templating/Resources/Private/Forms/Contact.form.yaml
}

# * News extension
# @see https://docs.typo3.org/p/georgringer/news/master/en-us/Introduction/Index.html

# create the list and the details objects
# they can be added to a template with:
#    <f:cObject typoscriptObjectPath="lib.tx_ottemplating.widgets.news_list" />
#    <f:cObject typoscriptObjectPath="lib.tx_ottemplating.widgets.news_detail" />
lib.tx_ottemplating.widgets {
    news_list = USER
    news_list {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = News
        pluginName = Pi1
        vendorName = GeorgRinger
        action = list
        switchableControllerActions {
            News {
                1 = list
            }
        }

        settings < plugin.tx_news.settings
        settings {
            # settings for the news.list plugin
            # @see https://docs.typo3.org/p/georgringer/news/master/en-us/AdministratorManual/Configuration/TypoScript/#
            list.paginate {
                insertAbove = 0
            }
        }
    }

    news_detail < lib.tx_ottemplating.widgets.news_list
    news_detail {
        action = detail
        switchableControllerActions.News.1 = detail
    }
}
