andreilupu / cf7-gutenberg

Contact Form 7 - Gutenberg block implementation
GNU General Public License v3.0
6 stars 1 forks source link

Allow overwriting contact form attributes #2

Open andreilupu opened 6 years ago

andreilupu commented 6 years ago

I think it would be a very useful feature if every block could overwrite the attributes of the shortcode.

Basically, we could have an email field which could overwrite the "to-send" value from the contact form settings.

It's somehow possible https://contactform7.com/getting-default-values-from-shortcode-attributes/

ineagu commented 6 years ago

right, the elementor widget should a good example, the idea of having a cf7 block is that it would be more useful that the classic shortcode, having more settings in one place will make it useful 🗡

andreilupu commented 6 years ago

I think I've hit the wall here and I'm not sure what is the preferred direction for these settings, but it's not simple.

My initial wish was to simply overwrite form settings through shortcode attributes like this: [contact-form-7 title="Newsletter" mailto="overwrite@email.com"]

But after a lot of tries, I think this isn't possible due the fact that these shortcode params are not passed to the submission process. Even if this path is dead to me, I've did sent an email to the Contact Form 7 maintainer and asked if this will change in the future.


I already studied an alternative way of doing this. Imagine if the attributes from the right sidebar would be for preview-only in the first place and if the user wants to edit the block settings, like the email, he should be warned about the fact that it will edit the form itself through REST API.

Even better we could clone a new contact form 7 post type with the current page title attached when the user wants to edit form settings.

The disadvantage would be the fact that each block should have its own contact form.

I will keep researching this, just wanted to ask some general opinions about this. @ineagu @selul @abaicus

ineagu commented 6 years ago

@andreilupu we should find a good balance between usability and complexity, that's why I have mentioned : https://wordpress.org/plugins/cf7-widget-elementor/ to see what it can be done easily.

  1. User can configure from sidebar a success page
  2. User can change the style ( font/color etc ).

Adding those things alone + blockifying part can make this strong enough.