| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template: Fields Group — group wrapper. |
| 4 |
* |
| 5 |
* @var array<string, mixed> $settings Field settings. |
| 6 |
* @var mixed $value Field value. |
| 7 |
* @var string $module_id Module ID. |
| 8 |
* @var bool $inside_flexible Whether group is inside flexible_content. |
| 9 |
* @var array<string, mixed> $args Extra args when inside flexible_content. |
| 10 |
* @var bool $control_field_status Whether status dropdown is enabled. |
| 11 |
* @var bool $accordion Whether accordion is enabled. |
| 12 |
* @var bool $state Whether accordion is open. |
| 13 |
* |
| 14 |
* @package Merchant |
| 15 |
* @since 2.2.5 |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
?> |
| 23 |
<div class="merchant-group-field<?php |
| 24 |
echo $accordion ? ' has-accordion' : ''; |
| 25 |
echo $control_field_status ? ' has-flag' : ''; |
| 26 |
echo $state ? ' open' : ''; |
| 27 |
echo ' merchant-group-field-' . esc_attr( $settings['id'] ) ?>" data-id="<?php |
| 28 |
echo esc_attr( $settings['id'] ) ?>"> |
| 29 |
<div class="title-area<?php |
| 30 |
echo $accordion ? ' accordion-style' : '' ?>"> |
| 31 |
<?php |
| 32 |
if ( ! empty( $settings['title'] ) ) { |
| 33 |
printf( '<div class="merchant-module-page-setting-field-title">%s<span class="field-status hidden"></span></div>', esc_html( $settings['title'] ) ); |
| 34 |
} |
| 35 |
if ( ! empty( $settings['sub-desc'] ) ) { |
| 36 |
printf( '<div class="merchant-module-page-setting-field-desc">%s</div>', wp_kses_post( $settings['sub-desc'] ) ); |
| 37 |
} |
| 38 |
if ( $accordion ) { |
| 39 |
?> |
| 40 |
<span class="accordion-icon dashicons dashicons-arrow-down-alt2"></span> |
| 41 |
<?php |
| 42 |
} |
| 43 |
?> |
| 44 |
</div> |
| 45 |
<div class="merchant-group-fields-container"> |
| 46 |
<?php |
| 47 |
if ( $control_field_status ) { |
| 48 |
include __DIR__ . '/status.php'; |
| 49 |
} |
| 50 |
|
| 51 |
foreach ( $settings['fields'] as $field ) { |
| 52 |
if ( $inside_flexible ) { |
| 53 |
Merchant_Field_Fields_Group::render_sub_field( |
| 54 |
$field, |
| 55 |
$args['value'][ $settings['id'] ][ $field['id'] ] ?? ( $field['default'] ?? '' ), |
| 56 |
"name=\"merchant[{$field['id']}]", |
| 57 |
"name=\"merchant[{$args['id']}][{$args['option_key']}][{$settings['id']}][{$field['id']}]\" data-name=\"merchant[{$args['id']}][0][{$settings['id']}][{$field['id']}]", |
| 58 |
$module_id |
| 59 |
); |
| 60 |
} else { |
| 61 |
Merchant_Field_Fields_Group::render_sub_field( |
| 62 |
$field, |
| 63 |
isset( $value[ $field['id'] ] ) ? $value[ $field['id'] ] : ( $field['default'] ?? '' ), |
| 64 |
"name=\"merchant[{$field['id']}]", |
| 65 |
"name=\"merchant[{$settings['id']}][{$field['id']}]", |
| 66 |
$module_id |
| 67 |
); |
| 68 |
} |
| 69 |
} ?> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|