WP Manifestindependent plugin directory
manifest / forms / wp-forms

Develtio Forms

Make forms easier to develop

★ 2stars
1.8.1latest · 5 years ago

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/develtio/wp-forms/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Develtio Forms

Plugin that allows you to create and manage forms. Each created form generates a new post type and saves all sent data as separate fields in WP administration.

Use

We use the Nette From library to building the forms (https://doc.nette.org/en/3.0/forms)

Example

if ( class_exists( '\Develtio\WP\Forms\Modules\Forms\CreateForm' ) ) {
    $options = [ 
        'send_mail' => true, // enables / disables sending an email, enabled by default
        'send_confirm_mail' => true // enables / disables sending of confirmation email, disabled by default
    ];

    $instance = new \Develtio\WP\Forms\Modules\Forms\CreateForm('Sample Form', $options);

    $mail = $instance->mail;
    $mail->setFrom(['noreply@example.com' => 'Sample form']);
    $mail->setTo(['info@example.com']);
    $mail->setTitle('Mail title');
    $mail->setConfirmMailField('contact_email'); // optional, if we send a confirmation e-mail, enter the name of the field from which the e-mail address is to be retrieved


    $form = $instance->form; // Nette Forms Instance
    $form->addText('contact_name')->setHtmlAttribute('placeholder', __('Name', 'develtio'));
    $form->addEmail( 'contact_email' )->setHtmlAttribute( 'placeholder', __( 'E-mail' ) )->setRequired( true );    

    $instance->save(); // Generate a form and post type
}

Example with CSV export for CPT

    $options = [ 
        'send_mail' => true, // enables / disables sending an email, enabled by default
        'send_confirm_mail' => true // enables / disables sending of confirmation email, disabled by default
        'csv_export' => true,
        'csv_export_fields' => [
            'id' => 'ID',
            'date' => 'Created At',
            'form_name' => 'Name',
            'form_surname' => 'Surname',
            'form_email' => 'Email',
            'form_phone' => 'Phone',
            'form_specialization' => 'Specialization',
            'form_experience' => 'Experience',
            'form_description' => 'Description',
            'form_linkedin' => 'LinkedIn',
            'form_cv' => 'CV',
            'form_consent' => 'Consent'
        ]
    ];

Templates

Form template

By default, the fields will be displayed below each other, Nette Forms provides a modification of this display presented here https://doc.nette.org/en/3.0/form-rendering Alternatively, you can manually set the display of the form with $instance->setTemplate($template); and special fields names field-name_field and field-name_error if you want to use forms as a shortcode.

Example
<form method="post" action="/" class="form--default" enctype="multipart/form-data">
    <div class="row">
        <div class="col-md-12">
            {contact_name_field}
            {contact_name_error}
        </div>
        <div class="col-md-12">
            {contact_email_field}
            {contact_email_error}
        </div>
    </div>
    <div class="row">
        <div class="col-md-24">
            <button type="submit">Send</button>
        </div>
    </div>
</div>

If the shortcode is not going to be used, you can create a template using, references $form['field-name']->control and $form['field-name']->error instead field-name_field and field-name_error

Success template

You can Customize thank you message in this way:

    $instance->setSuccessTemplate('<p>Thank you for contacting us</p>');

Confirm template

Method Params Description
$mail->setConfirmTemplate( $tempalte ) html or path to file full mail confirm template
$mail->setConfirmTemplateContent( $content ) html or string mail content
$mail->setConfirmTemplateTitle( $title ) html or string mail title

Mail template

Method Params Description
$mail->setMailTemplate( $tempalte ) html or path to file full mail template

In the place where the data should be displayed, place the {content} string.

Display

The form can be displayed in two ways. You can create your own function based on the instance $instance->form and display it in the appropriate place on the page, or You can use a shortcode that is generated automatically from the form name e.g. Sample form creates [sample-form] shortcode.

Releases

6 releases.

Tag
Published
1.8.1 latest
Jun 30, 2021 5 years ago
Apr 26, 2021 5 years ago
Apr 26, 2021 5 years ago
Apr 26, 2021 5 years ago
Apr 25, 2021 5 years ago
Apr 24, 2021 5 years ago

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