<?php
if ( ! defined( 'ABSPATH' ) ) exit;
/**
 * Multi-option checkbox group.
 *
 * Storage shape (preserved from Redux for back-compat):
 *   [ 'BTC' => '1', 'ETH' => '', ... ]  — every option key, '1' or ''.
 *
 * @var array  $field
 * @var mixed  $value
 * @var string $name_base
 */
$options = isset( $field['options'] ) && is_array( $field['options'] ) ? $field['options'] : array();
$value   = is_array( $value ) ? $value : array();
?>
<div class="cn-checkbox-group">
    <?php foreach ( $options as $key => $label ) :
        $checked = ! empty( $value[ $key ] );
        $row_id  = 'cn-field-' . $field['id'] . '-' . $key;
    ?>
        <label class="cn-checkbox-item" for="<?php echo esc_attr( $row_id ); ?>">
            <input type="checkbox"
                   id="<?php echo esc_attr( $row_id ); ?>"
                   name="<?php echo esc_attr( $name_base . '[' . $key . ']' ); ?>"
                   value="1"
                   <?php checked( $checked ); ?> />
            <span class="cn-checkbox-label"><?php echo esc_html( $label ); ?></span>
        </label>
    <?php endforeach; ?>
</div>
