PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.1.0
GiveWP – Donation Plugin and Fundraising Platform v4.1.0
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / FeatureFlags / OptionBasedFormEditor / ServiceProvider.php
ServiceProvider.php
55 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\FeatureFlags\OptionBasedFormEditor;
4
5 use Give\FeatureFlags\OptionBasedFormEditor\Settings\Advanced as AdvancedSettings;
6 use Give\FeatureFlags\OptionBasedFormEditor\Settings\DefaultOptions as DefaultOptionsSettings;
7 use Give\FeatureFlags\OptionBasedFormEditor\Settings\General as GeneralSettings;
8 use Give\Helpers\Hooks;
9 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface;
10
11 /**
12 * @since 3.18.0
13 */
14 class ServiceProvider implements ServiceProviderInterface
15 {
16 /**
17 * @since 3.18.0
18 */
19 public function register()
20 {
21 }
22
23 /**
24 * @since 3.18.0
25 */
26 public function boot()
27 {
28 $this->maybeDisableOptionBasedFormEditorSettings();
29 }
30
31 /**
32 * @return void
33 */
34 private function maybeDisableOptionBasedFormEditorSettings()
35 {
36 // General Tab
37 Hooks::addFilter('give_get_settings_general', GeneralSettings::class, 'maybeDisableOptions', 999);
38
39 // Payment Gateways Tab
40 add_filter('give_settings_payment_gateways_menu_groups', function ($groups) {
41 if ( ! OptionBasedFormEditor::isEnabled() && isset($groups['v2'])) {
42 unset($groups['v2']);
43 }
44
45 return $groups;
46 });
47
48 // Default Options Tab
49 Hooks::addFilter('give_get_settings_display', DefaultOptionsSettings::class, 'maybeDisableOptions', 999);
50
51 // Advance Tab
52 Hooks::addFilter('give_get_settings_advanced', AdvancedSettings::class, 'maybeDisableOptions', 999);
53 }
54 }
55