| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Renderer\GlobalSettings; |
| 4 |
|
| 5 |
use FluentForm\Framework\Foundation\Application; |
| 6 |
|
| 7 |
class Settings |
| 8 |
{ |
| 9 |
/** |
| 10 |
* @var \FluentForm\Framework\Foundation\Application |
| 11 |
*/ |
| 12 |
protected $app; |
| 13 |
|
| 14 |
/** |
| 15 |
* GlobalSettings constructor. |
| 16 |
* |
| 17 |
* @param \FluentForm\Framework\Foundation\Application $app |
| 18 |
*/ |
| 19 |
public function __construct(Application $app) |
| 20 |
{ |
| 21 |
$this->app = $app; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Render the page for native global settings components |
| 26 |
* |
| 27 |
* @throws \Exception |
| 28 |
*/ |
| 29 |
public function render() |
| 30 |
{ |
| 31 |
$this->enqueue(); |
| 32 |
|
| 33 |
$this->app->view->render('admin.settings.settings'); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Enqueue necessary resources. |
| 38 |
* |
| 39 |
* @throws \Exception |
| 40 |
*/ |
| 41 |
public function enqueue() |
| 42 |
{ |
| 43 |
wp_enqueue_script('fluentform-global-settings-js', |
| 44 |
fluentformMix("js/fluentform-global-settings.js"), |
| 45 |
['jquery'], $this->app->getVersion(), false |
| 46 |
); |
| 47 |
|
| 48 |
wp_localize_script('fluentform-global-settings-js', 'FluentFormApp', [ |
| 49 |
'plugin' => $this->app->getSlug(), |
| 50 |
]); |
| 51 |
} |
| 52 |
} |