| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\FormTaxonomies; |
| 4 |
|
| 5 |
use Give\Helpers\Hooks; |
| 6 |
use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface; |
| 7 |
|
| 8 |
/** |
| 9 |
* @since 3.16.0 |
| 10 |
*/ |
| 11 |
class ServiceProvider implements ServiceProviderInterface |
| 12 |
{ |
| 13 |
|
| 14 |
/** |
| 15 |
* @since 3.16.0 |
| 16 |
*/ |
| 17 |
public function register() |
| 18 |
{ |
| 19 |
give()->bind(Actions\EnqueueFormBuilderAssets::class, function() { |
| 20 |
$formId = absint($_GET['donationFormID'] ?? 0); |
| 21 |
return new Actions\EnqueueFormBuilderAssets( |
| 22 |
new ViewModels\FormTaxonomyViewModel($formId, give_get_settings()) |
| 23 |
); |
| 24 |
}); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* @since 3.16.0 |
| 29 |
*/ |
| 30 |
public function boot() |
| 31 |
{ |
| 32 |
Hooks::addAction('givewp_form_builder_updated', Actions\UpdateFormTaxonomies::class, '__invoke', 10, 2); |
| 33 |
Hooks::addAction('givewp_form_builder_enqueue_scripts', Actions\EnqueueFormBuilderAssets::class); |
| 34 |
} |
| 35 |
} |
| 36 |
|