PHP code example of digitaladapt / magento-vigilant-form-kit
1. Go to this page and download the library: Download digitaladapt/magento-vigilant-form-kit 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/ */
digitaladapt / magento-vigilant-form-kit example snippets
// SomeBlock.php
namespace SomeVendor\SomeModule\Block;
class SomeBlock extends \Magento\Framework\View\Element\Template
{
protected $vfmk;
public function __construct(\VigilantForm\MagentoKit\VigilantFormMagentoKit $vfmk)
{
$this->vfmk = $vfmk;
}
public function getVFMK()
{
return $this->vfmk;
}
}
// some_block.phtml
/** @var \SomeVendor\SomeModule\Block\SomeBlock $block */
// some_block.phtml
/** @var \SomeVendor\SomeModule\Block\SomeBlock $block */
$params = $this->getRequest()->getPost();
try {
$this->vfmk->submitForm($params);
} catch (\UnexpectedValueException $exception) {
/* do something, in the event failed to store form submission */
}
json
{
"url": "<SERVER_URL>",
"clientId": "<CLIENT_ID>",
"secret": "<CLIENT_SECRET>",
"prefix": null,
"honeypot": null,
"sequence": null,
"script_src": null,
"script_class": null,
"website": null,
"form_title": null
}