PHP code example of trendwerk / acf-forms

1. Go to this page and download the library: Download trendwerk/acf-forms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

trendwerk / acf-forms example snippets


$acfForms = new \Trendwerk\AcfForms\AcfForms();
$acfForms->init();

$acfForms->register($name, $options);

use Trendwerk\AcfForms\Form\Form;

Form::head();
...
$form = new Form($name);
$form->render();

$acfForms = new \Trendwerk\AcfForms\AcfForms();
$acfForms->init();

$acfForms->register('contact', [
    'acfForm'          => [
        'field_groups' => ['group_565474dcb9dd0'],
    ],
    'label'            => 'Contact',
]);


// Template name: Contact

use Timber\Post;
use Trendwerk\AcfForms\Form\Form;

Form::head();

$context = Timber::get_context();
$context['post'] = new Post();
$context['form'] = new Form('contact');

Timber::render('page-contact.twig', $context);