SiteConfigurationController

readonly class \TYPO3\CMS\Backend\Controller\SiteConfigurationController

Setup module main controller implementing the two main views 'overview' with 'list' and 'tiles', a details view, the edit view and save action.

Attributes

#[AsController]

Table of Contents

Properties

$componentFactory  : ComponentFactory
$iconFactory  : IconFactory
$moduleTemplateFactory  : ModuleTemplateFactory
$pageAncestryResolver  : PageAncestryResolver
$siteFinder  : SiteFinder
$uriBuilder  : UriBuilder

Methods

__construct()  : mixed
deleteAction()  : ResponseInterface
Delete an existing configuration
detailAction()  : ResponseInterface
This lists all information about a site: - URLs - Languages + Translation Strategy
editAction()  : ResponseInterface
Shows a form to create a new site configuration, or edit an existing one.
overviewAction()  : ResponseInterface
List pages that have 'is_siteroot' flag set - those that have the globe icon in page tree.
saveAction()  : ResponseInterface
Save incoming data from editAction and redirect to overview or edit
addDocHeaderBreadcrumb()  : void
Builds the breadcrumb for the views of a single site: the module, the site's root page and the current step below it.
addDocHeaderViewModeButton()  : void
View mode
configureDetailViewDocHeader()  : void
Create document header buttons of "detail" action
configureEditViewDocHeader()  : void
Create document header buttons of "edit" action
getAllSitePages()  : array
Returns a list of pages that have 'is_siteroot' set or are on pid 0 and not in list of excluded doktypes
getBackendUser()  : BackendUserAuthentication
getDuplicatedEntryPoints()  : array
Get all entry duplicates which are used multiple times
getLanguageService()  : LanguageService
getLastLanguageId()  : int
Returns the last (highest) language id from all sites
getMergeSiteData()  : array
Method keeps root config objects, which are not given via GUI. This way, extension authors are able to use their own objects on root level that are not configurable via GUI. However: We overwrite the full subset of any GUI object to make sure we have a clean state.
resolveConfigurationPathLabel()  : string
Resolve a configuration path like "languages.1.base" to the labels of the site configuration form, for example "Languages › German › Entry Point".
resolveDocumentTitle()  : string
Resolves the document title used for the browser tab and shortcut.
resolveReturnUrl()  : string
validateAndProcessIdentifier()  : mixed
Validation and processing of site identifier
validateAndProcessValue()  : mixed
Simple validation and processing method for incoming form field values.
validateFullStructure()  : array
Last sanitation method after all data has been gathered. Check integrity of full record, manipulate if possible, or throw exception if unfixable broken.
validateValueForRequired()  : bool
Checks if required=TRUE is set.

Properties

Methods

__construct()

public __construct(ComponentFactory $componentFactory, SiteFinder $siteFinder, IconFactory $iconFactory, UriBuilder $uriBuilder, ModuleTemplateFactory $moduleTemplateFactory, FormDataCompiler $formDataCompiler, FormResultFactory $formResultFactory, FormResultHandler $formResultHandler, SiteConfiguration $siteConfiguration, SiteWriter $siteWriter, NodeFactory $nodeFactory, SetRegistry $setRegistry, CategoryRegistry $categoryRegistry, SettingsTypeRegistry $settingsTypeRegistry, SiteSettingsService $siteSettingsService, FlashMessageService $flashMessageService, ConnectionPool $connectionPool, TcaSchemaBuilder $tcaSchemaBuilder, EnvPlaceholderProcessor $envPlaceholderProcessor, SiteTcaConfiguration $siteTcaConfiguration, PageAncestryResolver $pageAncestryResolver) : mixed

Parameters

$componentFactory : ComponentFactory
$siteFinder : SiteFinder
$iconFactory : IconFactory
$uriBuilder : UriBuilder
$moduleTemplateFactory : ModuleTemplateFactory
$formDataCompiler : FormDataCompiler
$formResultFactory : FormResultFactory
$formResultHandler : FormResultHandler
$siteConfiguration : SiteConfiguration
$siteWriter : SiteWriter
$nodeFactory : NodeFactory
$setRegistry : SetRegistry
$categoryRegistry : CategoryRegistry
$settingsTypeRegistry : SettingsTypeRegistry
$siteSettingsService : SiteSettingsService
$flashMessageService : FlashMessageService
$connectionPool : ConnectionPool
$tcaSchemaBuilder : TcaSchemaBuilder
$envPlaceholderProcessor : EnvPlaceholderProcessor
$siteTcaConfiguration : SiteTcaConfiguration
$pageAncestryResolver : PageAncestryResolver

deleteAction()

Delete an existing configuration

public deleteAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Return values

ResponseInterface

detailAction()

This lists all information about a site: - URLs - Languages + Translation Strategy

public detailAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Return values

ResponseInterface

editAction()

Shows a form to create a new site configuration, or edit an existing one.

public editAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Tags

throws
RuntimeException

Return values

ResponseInterface

overviewAction()

List pages that have 'is_siteroot' flag set - those that have the globe icon in page tree.

public overviewAction(ServerRequestInterface $request) : ResponseInterface

Link to Add / Edit / Delete for each.

Parameters

$request : ServerRequestInterface

Return values

ResponseInterface

saveAction()

Save incoming data from editAction and redirect to overview or edit

public saveAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Tags

throws
RuntimeException

Return values

ResponseInterface

addDocHeaderBreadcrumb()

Builds the breadcrumb for the views of a single site: the module, the site's root page and the current step below it.

protected addDocHeaderBreadcrumb(ModuleTemplate $view, array<string, mixed> $pageRecord, string|null $siteIdentifier, string|null $currentStepLabel[, string|null $currentStepIcon = null ]) : void

The site configuration module is not navigated via the page tree, so the root page is not part of a rootline here - it stands for the site itself and is the label the detail view carries as its headline. That makes the detail view the entry point for a single site, and every step below it links back to it. Passing no site identifier leaves the node unlinked, which is what the detail view itself and the "create new site" form need.

The current step carries the same icon as the button leading to it in the site overview.

Parameters

$view : ModuleTemplate
$pageRecord : array<string, mixed>

Root page of the site, empty for a new site

$siteIdentifier : string|null
$currentStepLabel : string|null
$currentStepIcon : string|null = null

configureDetailViewDocHeader()

Create document header buttons of "detail" action

protected configureDetailViewDocHeader(ModuleTemplate $view, string|null $siteIdentifier, ServerRequestInterface $request) : void

Parameters

$view : ModuleTemplate
$siteIdentifier : string|null
$request : ServerRequestInterface

configureEditViewDocHeader()

Create document header buttons of "edit" action

protected configureEditViewDocHeader(ModuleTemplate $view, string|null $siteIdentifier[, string $documentTitle = '' ]) : void

Parameters

$view : ModuleTemplate
$siteIdentifier : string|null
$documentTitle : string = ''

getAllSitePages()

Returns a list of pages that have 'is_siteroot' set or are on pid 0 and not in list of excluded doktypes

protected getAllSitePages() : array

Return values

array

getDuplicatedEntryPoints()

Get all entry duplicates which are used multiple times

protected getDuplicatedEntryPoints(Site[] $allSites, array $pages) : array

Parameters

$allSites : Site[]
$pages : array

Return values

array

getLastLanguageId()

Returns the last (highest) language id from all sites

protected getLastLanguageId() : int

Return values

int

getMergeSiteData()

Method keeps root config objects, which are not given via GUI. This way, extension authors are able to use their own objects on root level that are not configurable via GUI. However: We overwrite the full subset of any GUI object to make sure we have a clean state.

protected getMergeSiteData(array $currentSiteConfiguration, array $newSysSiteData) : array

Additionally, we also keep the baseVariants of languages, since they can't be modified via the GUI, but are part of the public API.

Parameters

$currentSiteConfiguration : array
$newSysSiteData : array

Return values

array

resolveConfigurationPathLabel()

Resolve a configuration path like "languages.1.base" to the labels of the site configuration form, for example "Languages › German › Entry Point".

protected resolveConfigurationPathLabel(string $configurationPath, array $configuration) : string

Parameters

$configurationPath : string
$configuration : array

Return values

string

resolveDocumentTitle()

Resolves the document title used for the browser tab and shortcut.

protected resolveDocumentTitle(LanguageService $languageService, bool $isNewConfig, string|null $siteIdentifier) : string

Parameters

$languageService : LanguageService
$isNewConfig : bool
$siteIdentifier : string|null

Return values

string

resolveReturnUrl()

protected resolveReturnUrl(ServerRequestInterface $request) : string

Parameters

$request : ServerRequestInterface

Return values

string

validateAndProcessIdentifier()

Validation and processing of site identifier

protected validateAndProcessIdentifier(bool $isNew, string $identifier, int $rootPageId, array<non-empty-string, Site> $allSites, array<int, Site> $mappingRootPageToSite, array $siteTca[, array<string, array> $invalidSites = [] ]) : mixed

Parameters

$isNew : bool

If true, we're dealing with a new record

$identifier : string

Given identifier to validate and process

$rootPageId : int

Page uid this identifier is bound to

$allSites : array<non-empty-string, Site>

All sites loaded without settings.yaml.

$mappingRootPageToSite : array<int, Site>

Identifier site mapping as lookup. Not loaded settings.yaml.

$siteTca : array

TCA for site

$invalidSites : array<string, array> = []

Sites which could not be resolved, indexed by identifier

Return values

mixed —

Verified / modified value

validateAndProcessValue()

Simple validation and processing method for incoming form field values.

protected validateAndProcessValue(string $tableName, string $fieldName, mixed $fieldValue, array $siteTca) : mixed

Note this does not support all TCA "eval" options but only what we really need.

Parameters

$tableName : string

Table name

$fieldName : string

Field name

$fieldValue : mixed

Incoming value from FormEngine

$siteTca : array

TCA for site

Tags

throws
SiteValidationErrorException
throws
RuntimeException

Return values

mixed —

Verified / modified value

validateFullStructure()

Last sanitation method after all data has been gathered. Check integrity of full record, manipulate if possible, or throw exception if unfixable broken.

protected validateFullStructure(array $newSysSiteData, bool $isNewConfiguration) : array

Parameters

$newSysSiteData : array

Incoming data

$isNewConfiguration : bool

Flag whether site configuration is new

Tags

throws
RuntimeException

Return values

array —

Updated data if needed

validateValueForRequired()

Checks if required=TRUE is set.

protected validateValueForRequired(array $tcaFieldConfig, mixed $value) : bool

If set: checks if the value is not empty (or not "0"). If not set or set to FALSE: Returns TRUE.

Parameters

$tcaFieldConfig : array
$value : mixed

Return values

bool
On this page