PHP code example of edalzell / forma

1. Go to this page and download the library: Download edalzell/forma 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/ */

    

edalzell / forma example snippets


\Edalzell\Forma\Forma::add('statamic-rad-pack/mailchimp', ConfigController::class);

'user' => [
    'check_consent' => true,
    'consent_field' => 'permission',
    'merge_fields' => [
        [
            'field_name' => 'first_name',
        ],
    ],
    'disable_opt_in' => true,
    'interests_field' => 'interests',
],

'user' => [
    [
        'check_consent' => true,
        'consent_field' => 'permission',
        'merge_fields' => [
            [
                'field_name' => 'first_name',
            ],
        ],
        'disable_opt_in' => true,
        'interests_field' => 'interests',
    ]
],

protected function postProcess(array $values): array
{
    $userConfig = Arr::get($values, 'user');

    return array_merge(
        $values,
        ['user' => $userConfig[0]]
    );
}

protected function preProcess(string $handle): array
{
    $config = config($handle);

    return array_merge(
        $config,
        ['user' => [Arr::get($config, 'user', [])]]
    );
}