Project

General

Profile

Actions

Feature #81593

closed

Usage of constants in YAML files

Added by Wolfgang Freund almost 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2017-06-16
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Are there any plans, or is it already possible to use constants in the FormDefinition YAML?
As for the email finishers i have to hardcode for example the recipientAddress.

As I work with different environments, mails should be sent to different recipients depending on the environment.

So it would be nice if following logic in the basic finishers would be possible:

finishers:
  -
    identifier: EmailToReceiver
    options:
      subject: 'Message form website'
      recipientAddress: {$my_site_package.fom.contact.recipient.email}
      recipientName: {$my_site_package.fom.contact.recipient.name}
      senderAddress: {$my_site_package.fom.contact.sender.email}
      senderName: {$my_site_package.fom.contact.sender.name}
      replyToAddress: '{email}'
      carbonCopyAddress: ''
      blindCarbonCopyAddress: ''
      format: html
      attachUploads: 'false'
      translation:
        language: 'en'


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #84133: Variants - Frontend implementationClosedRalf Zimmermann2018-05-24

Actions
Actions #1

Updated by Anonymous almost 7 years ago

Did you try TypoScript overrides? https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/Concepts/Index.html#typoscript-overrides
It's not exactly what you want, but sounds useful and I guess you could use constants there.

Actions #2

Updated by Wolfgang Freund almost 7 years ago

Yes already tried that. For me the approach with constants within the YAML file feels cleaner.
Nevertheless I tried some finisher overrides (for example the mail subject) and it does not seem to work in all cases...

Actions #3

Updated by Denis Mir over 6 years ago

The TS overrides are ok but constructs like

plugin.tx_form {
  settings {
    formDefinitionOverrides {
      SomeForm {
        renderables {
          0 {
            renderables {
              4 {
                properties {
                  privacyPageUid = {$plugin.someExt.general.privacyPagePid}
                }
              }
            }
          }
        }
      }
    }
  }
}

are not really nice since you have to hard code the indexes in the array which fail when something gets added in between in the configuration file. It would be a lot better to be able to use TS constants in the YML file.

Actions #4

Updated by Ralf Zimmermann about 6 years ago

Actions #5

Updated by Ralf Zimmermann about 6 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Wolfgang Freund

I think your use case can be handled with variants #84133.
Feel free to test the patchset :)

Actions #6

Updated by Christian Ludwig almost 6 years ago

The use of variants is really nice and useful but with constants you have imho some advantages.

  • You can centralize the things that need to be changed when moving to an other production stage. So simply changing or adding condition to one file will have effects to the complete installation.
  • When email addresses change, you will have one place to check and update.
  • It is possible to change constants within the page tree in a sub template (will break the two other advantages).

Or are all these things possible with #84133?

Actions #7

Updated by Denis Mir almost 6 years ago

Indeed Christian Ludwig is right.

For example we use constants as the one single entry point for configuration of the whole TYPO3 installation depending on locale, context and other conditions. We configure everything from one constants file sitting in our main extension. (every custom/sysext/third party extension including its plugins, modules etc.)

Variants look nice but I don't get why we need to duplicate all the functionality already available with constants. In addition it spreads the configuration all over our setup and adds another configuration point.

Variants do blow up the YAML file even further when it could be as easy as just reading the value from a constant.

Actions #8

Updated by Björn Jacob about 5 years ago

  • Status changed from Needs Feedback to New
  • Assignee deleted (Wolfgang Freund)
  • Priority changed from Should have to Could have
  • PHP Version deleted (7.1)
Actions #9

Updated by Mathias Brodala over 4 years ago

Thanks to #84203 you can now use placeholders in form setup files. With this, you can set up a form element definition using e.g. environment variables.

Notice that placeholders (and imports, see #84204) are currently still not supported in form definition files. That's why you need to use form setup files and form element definitions therein.

Does this help already?

Actions #10

Updated by Georg Ringer about 4 years ago

  • Status changed from New to Closed

closing this issue as constants is not the way to go for several reasons, one is that it needs quite much time to fetch all TS including all conditions to find the values.
environment variables are the way to go.

ps: greetings to wlwwt

Actions

Also available in: Atom PDF