Skip to content

Commit 3a2f2d3

Browse files
authored
Merge pull request #419 from BeAPI/feat/gf-default-theme
Add Gravity Forms service to force default forms theme
2 parents 9f4974c + 928fa16 commit 3a2f2d3

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

inc/Framework.php

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use BEA\Theme\Framework\Services\Assets_JS_Async;
99
use BEA\Theme\Framework\Services\Editor;
1010
use BEA\Theme\Framework\Services\Editor_Patterns;
11+
use BEA\Theme\Framework\Services\Gravity_Forms;
1112
use BEA\Theme\Framework\Services\Menu;
1213
use BEA\Theme\Framework\Services\Sidebar;
1314
use BEA\Theme\Framework\Services\Svg;
@@ -37,6 +38,7 @@ class Framework {
3738
Assets_JS_Async::class,
3839
Editor::class,
3940
Editor_Patterns::class,
41+
Gravity_Forms::class,
4042
Svg::class,
4143
Acf::class,
4244
Menu::class,

inc/Services/Gravity_Forms.php

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace BEA\Theme\Framework\Services;
4+
5+
use BEA\Theme\Framework\Service;
6+
use BEA\Theme\Framework\Service_Container;
7+
8+
class Gravity_Forms implements Service {
9+
10+
public function register( Service_Container $container ): void {
11+
}
12+
13+
public function boot( Service_Container $container ): void {
14+
add_filter( 'gform_form_theme_slug', [ $this, 'gform_form_theme_slug' ], 10, 1 );
15+
}
16+
17+
/**
18+
* Get service name
19+
*
20+
* @return string
21+
*/
22+
public function get_service_name(): string {
23+
return 'gravity-forms';
24+
}
25+
26+
/**
27+
* Force form default theme slug.
28+
*
29+
* @return string
30+
* @author Marie Comet
31+
*/
32+
public function gform_form_theme_slug(): string {
33+
return 'gravity-theme';
34+
}
35+
}

0 commit comments

Comments
 (0)