Skip to content

Commit

Permalink
Merge pull request #419 from BeAPI/feat/gf-default-theme
Browse files Browse the repository at this point in the history
Add Gravity Forms service to force default forms theme
  • Loading branch information
francoistibo authored Sep 9, 2024
2 parents 9f4974c + 928fa16 commit 3a2f2d3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions inc/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use BEA\Theme\Framework\Services\Assets_JS_Async;
use BEA\Theme\Framework\Services\Editor;
use BEA\Theme\Framework\Services\Editor_Patterns;
use BEA\Theme\Framework\Services\Gravity_Forms;
use BEA\Theme\Framework\Services\Menu;
use BEA\Theme\Framework\Services\Sidebar;
use BEA\Theme\Framework\Services\Svg;
Expand Down Expand Up @@ -37,6 +38,7 @@ class Framework {
Assets_JS_Async::class,
Editor::class,
Editor_Patterns::class,
Gravity_Forms::class,
Svg::class,
Acf::class,
Menu::class,
Expand Down
35 changes: 35 additions & 0 deletions inc/Services/Gravity_Forms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace BEA\Theme\Framework\Services;

use BEA\Theme\Framework\Service;
use BEA\Theme\Framework\Service_Container;

class Gravity_Forms implements Service {

public function register( Service_Container $container ): void {
}

public function boot( Service_Container $container ): void {
add_filter( 'gform_form_theme_slug', [ $this, 'gform_form_theme_slug' ], 10, 1 );
}

/**
* Get service name
*
* @return string
*/
public function get_service_name(): string {
return 'gravity-forms';
}

/**
* Force form default theme slug.
*
* @return string
* @author Marie Comet
*/
public function gform_form_theme_slug(): string {
return 'gravity-theme';
}
}

0 comments on commit 3a2f2d3

Please sign in to comment.