Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Undefined array key "pi_flexform" when including powermail form via TypoScript (fix provided) #1020

Closed
tntrpsw opened this issue May 7, 2024 · 2 comments
Labels

Comments

@tntrpsw
Copy link

tntrpsw commented May 7, 2024

Using TypoScript to include a powermail form seems to work, but when sending the form, there is an exception:

PHP Warning: Undefined array key "pi_flexform" in /var/www/web-dev8/html/typo3conf/ext/powermail/Classes/Domain/Validator/AbstractValidator.php line 136

Tested using powermail 12.3.1 under TYPO3 12.4.14, the problem seems to be, that within the constructor of the class "AbstractValidator" the key "pi_flexform" of the "data" array is assumed to be existing. This however is not the case when using TypoScript to include the form - there is no content object.

Quickly changing the following lines ...

$this->flexForm = $flexFormService->convertFlexFormContentToArray(
            // @extensionScannerIgnoreLine Seems to be a false positive: getContentObject() is still correct in 9.0
            $configurationManager->getContentObject()->data['pi_flexform']
);

... to this ...

$this->flexForm = $flexFormService->convertFlexFormContentToArray(
            // @extensionScannerIgnoreLine Seems to be a false positive: getContentObject() is still correct in 9.0
            $configurationManager->getContentObject()->data['pi_flexform'] ?? ''
);

... fixes the bug.

By the way: is there an official way to include a powermail form via TypoScript? Is using the following the way to go?

321 = USER_INT
321 {

    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = Powermail
    pluginName = Pi1
    vendorName = In2code
    controller = Form
    action = form

    settings {

      flexform {
        main.form = 123

        receiver.name = name of the receiver
        receiver.email = email@example.local

        receiver.subject = subject of the email
        receiver.body = {powermail_all}
	  }

    }

}
@mschwemer mschwemer added the v12 label May 21, 2024
@mschwemer
Copy link
Collaborator

Thx.

Your "fix" will be included in the next release.

But be aware

This is not an officially supported way to use EXT:powermail. Problably there are other extensions, that fit better into this usecase /f.e. EXT:form)

All necessary flexform values must be set in the TypoScript as mentioned here. We will not take care of any further warnings and exceptions, if you decide to include Powermail via TypoScript.

@mschwemer
Copy link
Collaborator

Included in 12.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants