Created
November 22, 2022 10:21
-
-
Save girafffee/5d359cd439683f477141dec42f084353 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'jet-form-builder/forms/options-generators', | |
'add_custom_jfb_generator' | |
); | |
function add_custom_jfb_generator( array $generators ) { | |
$generators[] = new class extends \Jet_Form_Builder\Generators\Base { | |
public function get_id() { | |
return 'custom_generator_id'; | |
} | |
public function get_name() { | |
return __( 'Custom generator name', 'jet-form-builder' ); | |
} | |
public function generate( $args ) { | |
// Get value from option "FIELD NAME" | |
$field_name = $args['generator_field'] ?? false; | |
// Single option must have "value" & "label" property | |
$row = array( | |
'value' => 1, | |
'label' => 'First Value' | |
); | |
return array( $row ); | |
} | |
}; | |
return $generators; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment