PHP code example of microman / kirby-form-block-suite

1. Go to this page and download the library: Download microman/kirby-form-block-suite 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/ */

    

microman / kirby-form-block-suite example snippets



<?= $my_block->toBlocks() =>


'microman.formblock' => [
    'from_email' => ["[email protected]" => "John Doe"]
],

'microman.formblock' => [
    'disable_html' => false
],

'microman.formblock' => [
  'honeypot_variants' => ["email", "name", "url"]
],

'microman.formblock' => [
  'placeholders' => [
    'ip' => [
      'label' => "IP address",
      'value' => function ($fields) {
        return $_SERVER['REMOTE_ADDR'];
      }
    ]
  ]
],

'microman.formblock' => [
  'disable_confirm' => true,
  'disable_notify' => true,
],

'microman.formblock' => [
  'email_template_confirmation' => ou a message
  `
],

'microman.formblock' => [
  'translations' => [
    'en' => [
        'success_message' => 'Your beautiful request has been sent.'
    ],
    'de' => [
        'success_message' => 'Deine wunderschöne Anfrage wurde versendet.'
    ]
  ]
],

'microman.formblock' => [
  'dynamic_validation' => false,
],

'microman.formblock' => [
  'email_field' => 'email',
],

'hooks' => [
  'formblock.success:after' => function (\microman\FormRequest $request) {
      //Your code
  },
  
]

'hooks' => [
  'formblock.validation:before' => function (string $slug, string $value, array $errors): array
  {
    if ($slug === 'email' && in_array($value, [ '[email protected]', '[email protected]' ])) {
      array_push($errors, "This is an invalid email adress.");
    }
    return $errors;
  }
]

'microman.formblock' => [
  'default_language' => 'de'
]

xml
 foreach ($form->fields() as $field) :