| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Form; |
| 4 |
|
| 5 |
use FluentForm\App\Services\Form\Fields; |
| 6 |
use FluentForm\Framework\Foundation\Application; |
| 7 |
|
| 8 |
class Inputs |
| 9 |
{ |
| 10 |
/** |
| 11 |
* Request object |
| 12 |
* |
| 13 |
* @var \FluentForm\Framework\Request\Request |
| 14 |
*/ |
| 15 |
private $request; |
| 16 |
|
| 17 |
/** |
| 18 |
* Build the class instance |
| 19 |
* |
| 20 |
* @throws \Exception |
| 21 |
*/ |
| 22 |
public function __construct(Application $application) |
| 23 |
{ |
| 24 |
$this->request = $application->request; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Get all the flatten form inputs for shortcode generation. |
| 29 |
*/ |
| 30 |
public function index() |
| 31 |
{ |
| 32 |
$formId = $this->request->get('formId'); |
| 33 |
|
| 34 |
wp_send_json((new Fields())->get($formId), 200); |
| 35 |
} |
| 36 |
} |
| 37 |
|