WP Manifestindependent plugin directory
manifest / forms / wp-forms

Silverback Form Classes

Extensible Wordpress form framework for busy developers

by Silverback Studio · github.com/silverbackstudio/wp-forms · website

0stars
1forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/silverbackstudio/wp-forms/archive/refs/heads/master.zip

Readme

Silverback Wordpress Forms

Requires silverbackstudio/wp-email to send emails.

Example

use Svbk\WP;
use Svbk\WP\Email;

/**
* Register forms after theme setup.
*    
* @return void
*/
function register_custom_forms() {

    /**
    * Set the default email marketing platform and transactional email service
    */  
    Forms\Form::setDefaults( 
        array(
            // Sendinblue           
            'transactional' => new Email\Transactional\SendInBlue,
            'marketing' => new Email\Marketing\SendInBlue,

            // Mailchimp:
            //'transactional' => new Email\Transactional\Mandrill( 'mandrill-apikey' ),
            //'marketing' => new Email\Marketing\MailChimp( 'mailchimp-apikey' ),
        )
    );


    /**
    * Creates a `Subscribe` form named 'trial' 
    */      
    Forms\Manager::create( 'trial', Forms\Subscribe::class, 
        [
            'marketing_lists' => array( 8 ),
        ] 
    );      


}

add_action( 'after_setup_theme', 'register_custom_forms', 11 );

Creates a Contact form named 'contact' and return the form instance


$trial_form = Forms\Manager::create( 'contact', Forms\Contact::class, [
    'admin_template' => 'template-id-or-name',
    'user_template' => 'template-id-or-name',
    'marketing_lists' => array( 1 ),
    'recipient' => new Email\Contact( [ 'email' => env('RECIPIENT_EMAIL') ] ),   

    // to customize policy flag texts
    //'policyScope' => __('<b>[privacy-controller-name]</b> will process your information to respond to your request.', '[textdomain]');
    //'policyUnsubscribe' => __('You can unsubscribe at any time by clicking on the link at the bottom of each email.', '[textdomain]');
    //'policyAllText' => __( 'I have read and accept the [privacy-policy-link] and agree to receive personalized promotional informations.', '[textdomain]' );
    //'policyAllToggleText' ==> __( 'To select partial consents %s', '[textdomain]' );
    //'policyService' => __( 'I have read and agree to the [privacy-policy-link]', '[textdomain]' );
    //'policyNewsletter' => __( 'I have read the [privacy-policy-link] and agree to the processing of my data to receive informative material', '[textdomain]' );
    //'policyMarketing' => __( 'I have read the [privacy-policy-link] and agree to the processing of my data to receive personalized promotional materials based on my browsing data.', '[textdomain]' );
] );

See silverbackstudio/wp-shortcakes or silverbackstudio/wp-widgets see how to render forms in a shortcode or a widget.

Read the full README on GitHub →

Releases

TagPublished
2.2.9 Sep 6, 2018

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.