forked from siebsie23/gravity-forms-polylang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgf_pll.php
38 lines (33 loc) · 1.29 KB
/
gf_pll.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
Plugin Name: Translate Gravity Forms x Polylang
Plugin URI: https://github.com/wijzijnweb/gravity-forms-polylang
Description: This Wordpress plugin adds form titles, descriptions, field labels, etc, to Polylang string translations
Version: 1.0.3
Author: Wij zijn WEB
Author URI: https://github.com/wijzijnweb/gravity-forms-polylang
License: GPL2GNU General Public License v2.0
License URI: https://github.com/siebsie23/gravity-forms-polylang/blob/master/LICENSE
*/
if (!defined('ABSPATH')) {
exit;
}
if (!class_exists('GravityFormsPolylangInitialize')) :
include 'class_GF_PLL.php';
class GravityFormsPolylangInitialize
{
public static function registerStrings(): void
{
$gf_pll = new GravityFormsPolylang();
$gf_pll->registerStrings();
}
public static function translateStrings($form): mixed
{
$gf_pll = new GravityFormsPolylang();
return $gf_pll->translateStrings($form);
}
}
add_action('admin_init', array('GravityFormsPolylangInitialize', 'registerStrings'), 100);
add_filter('gform_pre_render', array('GravityFormsPolylangInitialize', 'translateStrings'));
add_filter('gform_pre_process', array('GravityFormsPolylangInitialize', 'translateStrings'));
endif;