Skip to content

Commit 8c91ddc

Browse files
committed
fix: beaver builder integration
1 parent 21cd657 commit 8c91ddc

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

prosopo-procaptcha/src/Plugin_Integrations/Beaver_Builder/Beaver_Modules.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ final class Beaver_Modules {
1515

1616
/**
1717
* @param string[] $setting_path
18-
* @param array<string,mixed> $setting_options
18+
* @param callable() :array<string,mixed> $get_setting_options callable, as translations are available only after 'init' hook.
1919
*/
20-
public static function add_module_setting( string $module, array $setting_path, array $setting_options ): void {
20+
public static function add_module_setting( string $module, array $setting_path, callable $get_setting_options ): void {
2121
add_filter(
2222
'fl_builder_register_module_settings_form',
23-
function ( array $form, string $slug ) use ( $module, $setting_path, $setting_options ): array {
23+
function ( array $form, string $slug ) use ( $module, $setting_path, $get_setting_options ): array {
2424
if ( $module === $slug ) {
2525
setItem(
2626
$form,
2727
$setting_path,
28-
$setting_options
28+
$get_setting_options()
2929
);
3030
}
3131

prosopo-procaptcha/src/Plugin_Integrations/Beaver_Builder/Forms/Beaver_Contact_Form_Integration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public function extend_contact_form(): void {
2525
Beaver_Modules::add_module_setting(
2626
$module_name,
2727
array( 'general', 'sections', 'general', 'fields', $field_name ),
28-
array(
28+
// callable, as translations are available only after 'init' hook.
29+
fn()=>array(
2930
'default' => 'disabled',
3031
'label' => __( 'Procaptcha protection', 'prosopo-procaptcha' ),
3132
'options' => array(

prosopo-procaptcha/src/Plugin_Integrations/Beaver_Builder/Forms/Beaver_Subscribe_Form_Integration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public function extend_subscribe_form(): void {
2525
Beaver_Modules::add_module_setting(
2626
$module_name,
2727
array( 'general', 'sections', 'structure', 'fields', $field_name ),
28-
array(
28+
// callable, as translations are available only after 'init' hook.
29+
fn()=>array(
2930
'default' => 'disabled',
3031
'label' => __( 'Procaptcha protection', 'prosopo-procaptcha' ),
3132
'options' => array(

0 commit comments

Comments
 (0)