$settings Field configuration. * @var string $layout Layout type key. * @var array $layout_config Layout configuration (title, fields, etc.). * @var int $option_key Row index. * @var array $option Row values. * @var bool $has_sorting Whether sorting is enabled. * @var bool $has_accordion Whether accordion is enabled. * @var bool $is_clone Whether this is a clone template (uses data-name instead of name). * @var bool $deferred Whether this row should use deferred rendering (lazy load). * @var string $module_id Module ID. * @var Merchant_Field_Flexible_Content $field The field instance. * * @package Merchant * @since 2.2.5 */ if ( ! defined( 'ABSPATH' ) ) { exit; } $deferred = ! empty( $deferred ); $title_field = $layout_config['title-field'] ?? ''; $row_title = $is_clone ? ( $layout_config['title'] ?? '' ) : ( $option[ $title_field ] ?? '' ); $count = $is_clone ? 1 : absint( $option_key + 1 ); $status_field = $layout_config['status-field'] ?? ''; $status_value = ''; if ( ! empty( $status_field ) ) { if ( $is_clone ) { // Clone template: default value will be set via JS on add/duplicate. $status_value = 'active'; } else { $status_value = $option[ $status_field ] ?? 'active'; } } $name_attr = $is_clone ? 'data-name' : 'name'; ?>
build_deferred_data( $layout_config['fields'] ?? array(), $option ); $json = wp_json_encode( $deferred_data ); echo ' data-fields-json="' . esc_attr( $json ? $json : '{}' ) . '"'; } ?>>
>
data-status-options="" >
$settings['id'], 'option_key' => 0, 'value' => $option, ) ); } else { Merchant_Field_Flexible_Content::render_sub_field( $sub_field, $sub_field['default'] ?? '', array( "name=\"merchant[{$sub_field['id']}]", 'merchant-module-page-setting-field-upload', 'merchant-module-page-setting-field-select_ajax', ), array( "data-name=\"merchant[{$settings['id']}][0][{$sub_field['id']}]", 'merchant-module-page-setting-field-upload template', 'merchant-module-page-setting-field-select_ajax template', ), $module_id ); } } else { // Live row: use actual values and name attributes. $sub_value = null; if ( isset( $option[ $sub_field['id'] ] ) ) { $sub_value = $option[ $sub_field['id'] ]; } elseif ( isset( $sub_field['default'] ) ) { $sub_value = $sub_field['default']; } elseif ( isset( $sub_field['type'] ) && $sub_field['type'] === 'switcher' ) { $sub_value = 0; } if ( 'fields_group' === $sub_field['type'] ) { Merchant_Field_Fields_Group::render_group( $sub_field, $sub_value, $module_id, true, array( 'id' => $settings['id'], 'option_key' => $option_key, 'value' => $option, ) ); } else { Merchant_Field_Flexible_Content::render_sub_field( $sub_field, $sub_value, "name=\"merchant[{$sub_field['id']}]", "name=\"merchant[{$settings['id']}][{$option_key}][{$sub_field['id']}]", $module_id ); } } ?>
="merchant[][][layout]" value=""> ="merchant[][][flexible_id]" value="">
get_template_part( 'actions', array( 'layout_type' => $layout, 'has_duplicate' => ! empty( $settings['duplicate'] ), 'has_accordion' => ! empty( $settings['accordion'] ), ) ); ?>