<?php
//cf7 New field : shortcode value
//<div class="hide">[custom_v_shortcode campaign]</div>
add_action( 'wpcf7_init', 'ds1_add_form_tag_v_shortcode' );

function ds1_add_form_tag_v_shortcode() {
    wpcf7_add_form_tag( array( 'custom_v_shortcode'),
        'ds1_add_form_wpcf7_mycustomfield_custom_v_shortcode', array( 'name-attr' => true ) );
}

function ds1_add_form_wpcf7_mycustomfield_custom_v_shortcode( $tag ) {
	global $post;
	
    $tag = new WPCF7_FormTag( $tag );

    if ( empty( $tag->name ) ) {
        return '';
    }

    $atts = array();

    $class = wpcf7_form_controls_class( $tag->type );
    $atts['class'] = $tag->get_class_option( $class );
    $atts['id'] = $tag->get_id_option();

    $atts['name'] = $tag->name;
    $atts = wpcf7_format_atts( $atts );
	
    $html = sprintf( '<input type="hidden" value="'.do_shortcode('[ds1getcookie name="'.$tag->name.'"]').'" data-su="'.$tag->name.'" %s></input>', $atts );
    return $html;
}