0

I'd like to define an API endpoint URL through a TypoScript constant, so that it can be overridden by editors.

At the same time I want to provide different default constant values depending on the TYPO3 Application Context (Development, Staging, Production).

How can I do this? Is it possible to use TypoScript conditions in constants files?

1 Answer 1

0

TypoScript:

plugin.tx_extension.url = TEXT
plugin.tx_extension.url.value = {$plugin.tx_extension.url}

[applicationContext == "Development/Local"]
    plugin.tx_extension.url.ifEmpty = bar
[end]

PHP: use ContentObjectRenderer to calculate the value:

$config = $this->getFrontendController()->tmpl->setup['plugin.']['tx_extension.'] ?? [];
$url = $this->getContentObjectRenderer()->cObjGetSingle(
    $config['url'],
    $config['url.']
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.