mailchimp
mailchimp copied to clipboard
Remove index from non cacheable Form action
Hey there,
First sorry for what could looked like a messy commit history. Didn't get this one started off in a branch, but the change is a one liner so I hope it's cool.
I'm not 100% sure if there's some downside with this but after trying various things, the was the only thing that worked.
Situation:
We run a signup form on all pages on the site creating the form using TS so we can show it in the footer and as a popover in some page views:
lib.footerMailChimp = USER
lib.footerMailChimp {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Registration
extensionName = Mailchimp
vendorName = Sup7even
controller = Form
settings =< plugin.tx_mailchimp.settings
view =< plugin.tx_mailchimp.view
view.templateRootPaths.1 = path/to/our/template/mailchimp/Footer/Templates/
view.layoutRootPaths.1 = path/to/our/template/mailchimp/Footer/Layouts/
}
After moving to a new platform that includes Varnish caching, we noticed that all pages were missing the cache and so a USER_INT must be in play. Revising everything it turns out that the form is being created as USER_INT for some reason I don't understand.
Seems like there's no reason for that and so this PR is to remove it from the configurePlugin, as it will then render as a USER object.
If there's another way to force it as a USER without changing this, please let me know but I did some tests and it looks like the form works just fine (both with and without AJAX enabled) running as USER.
It must be not cached as it also shows the errors if not filled correctly. If you are using it with ajax, I would propose to create a custom action which does the form
mmm, okay, can you point in the direction in making a custom action? I was considering that and since I use it with AJAX all places it does show the error message correctly. Would it not be possible to switch to no cached if AJAX is not enabled?
@houmark you could make that an extension configuration setting. And then define the plugin actions based on that setting.