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
| console.log('loaded'); | |
| function myDynamicOptionsCallback(resolve, reject){ | |
| // alert('Fetching select options'); | |
| console.log('Callback start'); | |
| setTimeout(function(){ | |
| console.log('Resolving'); | |
| resolve([ | |
| { | |
| value: 'aye', |
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 | |
| /** | |
| * Plugin Name: Ninja Forms Sandbox | |
| */ | |
| add_action( 'wp_enqueue_scripts', function() { | |
| wp_enqueue_script('ninja_forms_display_sandbox', plugin_dir_url(__FILE__) . 'script.js', ['nf-front-end'], time() ); | |
| }); |
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( 'ninja_shop_possible_template_paths', function( $paths ) { | |
| $paths[] = dirname( __FILE__ ) . '/templates/'; | |
| return $paths; | |
| } ); |
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( 'ninja_forms_action_email_attachments', function( $attachments, $data, $settings ) { | |
| // Append file path. | |
| $attachments[] = $path_to_file; | |
| return $attachments; | |
| }, 10, 3 ); |
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 | |
| /** | |
| * Update list options during form render. | |
| * | |
| * @param array $options [ [ label, value, calc, (bool) selected, etc ], ... ] | |
| * @param array $settings | |
| */ | |
| add_filter( 'ninja_forms_render_options', function( $options, $settings ) { | |
| $options[] = [ |
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( 'ninja_forms_submit_data', function( $form_data ){ | |
| if( ! my_nf_validation( $form_data ) ) { // Add check here. | |
| $errors = [ | |
| 'fields' => [ | |
| '12' => __( 'An unexpected error occurred.', 'my-plugin' ) | |
| ], |
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_action( 'nf_get_form_id', function( $form_id ) { | |
| if( '12' == $form_id ) { | |
| $recaptcha_lang = 'en'; | |
| Ninja_Forms()->update_setting( 'recaptcha_lang', $recaptcha_lang, true ); | |
| } | |
| }); |
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 | |
| /** | |
| * Wrap hooks for a specific form. | |
| * | |
| * @param int $form_id | |
| */ | |
| add_action( 'nf_get_form_id', function( $form_id ){ | |
| // Check for a specific Form ID. |
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 | |
| /** | |
| * Change a field's settings when localized to the page. | |
| * | |
| * @param array $field [ id, settings => [ type, key, label, etc. ] ] | |
| * @return array $field | |
| */ | |
| add_filter( 'ninja_forms_localize_field', function( $field ){ | |
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 | |
| /** | |
| * Wrap hooks for a specific form. | |
| * | |
| * @param int $form_id | |
| */ | |
| add_action( 'nf_get_form_id', function( $form_id ){ | |
| // Check for a specific Form ID. |