<?php
/**
 * CodeMirror Field Template for WPCFTO.
 *
 * Variables available:
 *  - $field
 *  - $field_id
 *  - $field_value
 *  - $field_label
 *  - $field_name
 *  - $section_name
 */

// This is a string path like: data['variation']['fields']['my_field']
$field_ref = "data['{$section_name}']['fields']['{$field_name}']";
?>
<wpcfto_codemirror
  :fields='<?php echo esc_attr($field_ref); ?>'
  :field_label='<?php echo esc_attr($field_label); ?>'
  :field_name="'<?php echo esc_js($field_name); ?>'"
  :field_id="'<?php echo esc_js($field_id); ?>'"
  :field_value="'<?php echo esc_js($field_value); ?>'"

  @wpcfto-get-value="$set(<?php echo $field_ref; ?>, 'value', $event)"
></wpcfto_codemirror>