| @@ -589,8 +589,12 @@ | ||
| 589 | 589 | * @return void |
| 590 | 590 | */ |
| 591 | 591 | public static function show_fields( $fields, $errors, $form, $form_action ) { |
| 592 | 592 | foreach ( $fields as $field ) { |
| 593 | + if ( ! is_array( $field ) ) { | |
| 594 | + continue; | |
| 595 | + } | |
| 596 | + | |
| 593 | 597 | $field_obj = FrmFieldFactory::get_field_type( $field['type'], $field ); |
| 594 | 598 | $field_obj->show_field( compact( 'errors', 'form', 'form_action' ) ); |
| 595 | 599 | } |
| 596 | 600 | } |
| @@ -959,13 +963,11 @@ | ||
| 959 | 963 | } elseif ( $cond === '!=' ) { |
| 960 | 964 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 961 | 965 | $m = ! in_array( $hide_opt, $observed_value ); |
| 962 | 966 | } elseif ( $cond === '>' ) { |
| 963 | - $min = min( $observed_value ); | |
| 964 | - $m = $min > $hide_opt; | |
| 967 | + $m = min( $observed_value ) > $hide_opt; | |
| 965 | 968 | } elseif ( $cond === '<' ) { |
| 966 | - $max = max( $observed_value ); | |
| 967 | - $m = $max < $hide_opt; | |
| 969 | + $m = max( $observed_value ) < $hide_opt; | |
| 968 | 970 | } elseif ( $cond === 'LIKE' || $cond === 'not LIKE' ) { |
| 969 | 971 | foreach ( $observed_value as $ob ) { |
| 970 | 972 | $m = strpos( $ob, $hide_opt ); |
| 971 | 973 | |
| @@ -2362,8 +2364,39 @@ | ||
| 2362 | 2364 | return $field_array + $field_options; |
| 2363 | 2365 | } |
| 2364 | 2366 | |
| 2365 | 2367 | /** |
| 2368 | + * Shows add field link. | |
| 2369 | + * | |
| 2370 | + * @since 6.30 | |
| 2371 | + * | |
| 2372 | + * @param array $field_type See file `classes/views/frm-forms/add_field_links.php`. | |
| 2373 | + * | |
| 2374 | + * @return void | |
| 2375 | + */ | |
| 2376 | + public static function show_add_field_link( $field_type ) { | |
| 2377 | + $field_label = FrmFormsHelper::get_field_link_name( $field_type ); | |
| 2378 | + $classes = 'frmbutton frm6 frm_t' . $field_type['key']; | |
| 2379 | + | |
| 2380 | + if ( ! empty( $field_type['hide'] ) ) { | |
| 2381 | + $classes .= ' frm_hidden'; | |
| 2382 | + } | |
| 2383 | + ?> | |
| 2384 | +<li class="<?php echo esc_attr( $classes ); ?>" id="<?php echo esc_attr( $field_type['key'] ); ?>"> | |
| 2385 | + <a href="#" class="frm_add_field" title="<?php echo esc_attr( $field_label ); ?>" role="button" aria-label="<?php echo esc_attr( $field_label ); ?>"> | |
| 2386 | + <?php FrmAppHelper::icon_by_class( FrmFormsHelper::get_field_link_icon( $field_type ) ); ?> | |
| 2387 | + <span><?php echo esc_html( $field_label ); ?></span> | |
| 2388 | + <?php | |
| 2389 | + if ( 'credit_card' === $field_type['key'] && ! FrmTransLiteAppHelper::payments_table_exists() ) { | |
| 2390 | + FrmAppHelper::show_pill_text(); | |
| 2391 | + } | |
| 2392 | + ?> | |
| 2393 | + </a> | |
| 2394 | +</li> | |
| 2395 | + <?php | |
| 2396 | + } | |
| 2397 | + | |
| 2398 | + /** | |
| 2366 | 2399 | * @since 4.04 |
| 2367 | 2400 | * |
| 2368 | 2401 | * @param array $args |
| 2369 | 2402 | * |
| @@ -2620,8 +2653,12 @@ | ||
| 2620 | 2653 | 'content' => 'button-options', |
| 2621 | 2654 | ), |
| 2622 | 2655 | ); |
| 2623 | 2656 | |
| 2657 | + if ( 'product' === FrmField::get_field_type( $field ) ) { | |
| 2658 | + unset( $options['buttons'] ); | |
| 2659 | + } | |
| 2660 | + | |
| 2624 | 2661 | /** |
| 2625 | 2662 | * Allows modifying the options of Display format setting of Radio field. |
| 2626 | 2663 | * |
| 2627 | 2664 | * @since 5.0.04 |
| @@ -2806,12 +2843,13 @@ | ||
| 2806 | 2843 | * @return void |
| 2807 | 2844 | */ |
| 2808 | 2845 | public static function render_ai_generate_options_button( $args, $should_hide_bulk_edit = false ) { |
| 2809 | 2846 | $attributes = array( |
| 2810 | - 'type' => 'button', | |
| 2811 | - 'class' => self::get_ai_generate_options_button_class(), | |
| 2847 | + 'type' => 'button', | |
| 2812 | 2848 | ); |
| 2813 | 2849 | |
| 2850 | + $attributes['class'] = ! empty( $args['class'] ) ? $args['class'] : self::get_ai_generate_options_button_class(); | |
| 2851 | + | |
| 2814 | 2852 | if ( $should_hide_bulk_edit ) { |
| 2815 | 2853 | $attributes['class'] .= ' frm-force-hidden'; |
| 2816 | 2854 | } |
| 2817 | 2855 | |
| @@ -2818,9 +2856,9 @@ | ||
| 2818 | 2856 | $data = FrmAppHelper::get_upgrade_data_params( |
| 2819 | 2857 | 'ai', |
| 2820 | 2858 | array( |
| 2821 | 2859 | 'requires' => 'Business', |
| 2822 | - 'upgrade' => __( 'Generate options with AI', 'formidable' ), | |
| 2860 | + 'upgrade' => $args['upgrade_text'] ?? __( 'Generate options with AI', 'formidable' ), | |
| 2823 | 2861 | 'medium' => 'builder', |
| 2824 | 2862 | 'content' => 'generate-options-with-ai', |
| 2825 | 2863 | ), |
| 2826 | 2864 | true |