/**
  * Enqueue and retrieve all inline scripts that should be executed when the form is rendered.
  * Use add_init_script() function to enqueue scripts.
  *
  * @param array $form
  * @param array $field_values
  * @param bool  $is_ajax
  */
 public static function register_form_init_scripts($form, $field_values = array(), $conditional_logic_enabled = true)
 {
     $is_ajax = false;
     // adding conditional logic script if conditional logic is configured for this form.
     // get_conditional_logic also adds the chosen script for the enhanced dropdown option.
     // if this form does not have conditional logic, add chosen script separately
     if ($conditional_logic_enabled && GFFormDisplay::has_conditional_logic($form)) {
         GFFormDisplay::add_init_script($form['id'], 'number_formats', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_number_formats_script($form));
         GFFormDisplay::add_init_script($form['id'], 'conditional_logic', GFFormDisplay::ON_PAGE_RENDER, self::get_conditional_logic($form, $field_values));
     }
     //adding currency config if there are any product fields in the form
     if (self::has_price_field($form)) {
         GFFormDisplay::add_init_script($form['id'], 'pricing', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_pricing_init_script($form));
     }
     if (self::has_password_strength($form)) {
         $password_script = GFFormDisplay::get_password_strength_init_script($form);
         GFFormDisplay::add_init_script($form['id'], 'password', GFFormDisplay::ON_PAGE_RENDER, $password_script);
     }
     if (self::has_enhanced_dropdown($form)) {
         $chosen_script = GFFormDisplay::get_chosen_init_script($form);
         GFFormDisplay::add_init_script($form['id'], 'chosen', GFFormDisplay::ON_PAGE_RENDER, $chosen_script);
         GFFormDisplay::add_init_script($form['id'], 'chosen', GFFormDisplay::ON_CONDITIONAL_LOGIC, $chosen_script);
     }
     if (self::has_character_counter($form)) {
         GFFormDisplay::add_init_script($form['id'], 'character_counter', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_counter_init_script($form));
     }
     if (GFFormDisplay::has_input_mask($form)) {
         GFFormDisplay::add_init_script($form['id'], 'input_mask', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_input_mask_init_script($form));
     }
     if (GFFormDisplay::has_calculation_field($form)) {
         GFFormDisplay::add_init_script($form['id'], 'number_formats', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_number_formats_script($form));
         GFFormDisplay::add_init_script($form['id'], 'calculation', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_calculations_init_script($form));
     }
     if (self::has_currency_format_number_field($form)) {
         GFFormDisplay::add_init_script($form['id'], 'currency_format', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_currency_format_init_script($form));
     }
     if (self::has_currency_copy_values_option($form)) {
         GFFormDisplay::add_init_script($form['id'], 'copy_values', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_copy_values_init_script($form));
     }
     if (self::has_placeholder($form)) {
         GFFormDisplay::add_init_script($form['id'], 'placeholders', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_placeholders_init_script($form));
     }
     if (isset($form['fields']) && is_array($form['fields'])) {
         foreach ($form['fields'] as $field) {
             /* @var GF_Field $field */
             if (is_subclass_of($field, 'GF_Field')) {
                 $field->register_form_init_scripts($form);
             }
         }
     }
     gf_do_action(array('gform_register_init_scripts', $form['id']), $form, $field_values, $is_ajax);
 }