| @@ -2,37 +2,43 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Images dropdown option view |
| 4 | 4 | * |
| 5 | 5 | * @since 5.0.04 |
| 6 | - * | |
| 7 | 6 | * @package Formidable |
| 8 | 7 | * |
| 9 | - * @var array $args The arguments of images_dropdown() method. | |
| 8 | + * @var array $args The arguments of images_dropdown() method. | |
| 9 | + * @var array $option The option data. | |
| 10 | + * @var string $image The image HTML. | |
| 11 | + * @var string $classes The HTML classes. | |
| 12 | + * @var string $custom_attrs The custom HTML attributes. | |
| 10 | 13 | */ |
| 11 | 14 | |
| 12 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | 16 | die( 'You are not allowed to call this page directly.' ); |
| 14 | 17 | } |
| 18 | +?> | |
| 19 | +<div class="frm_images_dropdown frm_grid_container <?php echo esc_attr( $args['classes'] ); ?>"> | |
| 20 | + <?php | |
| 21 | + foreach ( $args['options'] as $key => $option ) { | |
| 22 | + $option['key'] = $key; | |
| 15 | 23 | |
| 16 | -$component_options = array(); | |
| 17 | - | |
| 18 | -foreach ( $args['options'] as $key => $option ) { | |
| 19 | - $option['key'] = $key; | |
| 20 | - $image_details = FrmAppHelper::get_images_dropdown_atts( $option, $args ); | |
| 21 | - | |
| 22 | - $component_options[] = array( | |
| 23 | - 'label' => $option['text'], | |
| 24 | - 'value' => $key, | |
| 25 | - 'classes' => $image_details['classes'], | |
| 26 | - 'custom_attrs' => $image_details['custom_attrs'], | |
| 27 | - ); | |
| 28 | -} | |
| 29 | - | |
| 30 | -new FrmTextToggleStyleComponent( | |
| 31 | - $args['name'], | |
| 32 | - $args['selected'] ?? 0, | |
| 33 | - array( | |
| 34 | - 'classname' => $args['classes'], | |
| 35 | - 'options' => $component_options, | |
| 36 | - 'input_attrs_str' => $input_attrs_str, | |
| 37 | - ) | |
| 38 | -); | |
| 24 | + $image = self::get_images_dropdown_option_image( $option, $args ); | |
| 25 | + $classes = self::get_images_dropdown_option_classes( $option, $args ); | |
| 26 | + $custom_attrs = self::get_images_dropdown_option_html_attrs( $option, $args ); | |
| 27 | + ?> | |
| 28 | + <div class="frm_radio frm_image_option frm<?php echo esc_attr( $args['col_class'] ); ?>"> | |
| 29 | + <label class="<?php echo esc_attr( $classes ); ?>" data-value="<?php echo esc_attr( $option['key'] ); ?>"<?php echo $custom_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 30 | + <input value="<?php echo esc_attr( $option['key'] ); ?>" <?php checked( $option['key'], $args['selected'] ); ?> <?php echo $input_attrs_str; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> /> | |
| 31 | + <div class="frm_image_option_container frm_grid_container"> | |
| 32 | + <span class="frm_images_dropdown__image frm4"> | |
| 33 | + <?php echo FrmAppHelper::kses( $image, 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 34 | + </span> | |
| 35 | + <span class="frm_text_label_for_image frm8"> | |
| 36 | + <?php echo esc_html( $option['text'] ); ?> | |
| 37 | + </span> | |
| 38 | + </div> | |
| 39 | + </label> | |
| 40 | + </div> | |
| 41 | + <?php | |
| 42 | + } | |
| 43 | + ?> | |
| 44 | +</div> | |