scan_form_tags( array( 'type' => array( 'uacf7_star_rating*', ), ) ); foreach ( $tags as $tag ) { $schema->add_rule( wpcf7_swv_create_rule( 'required', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } } /* * Create form tag: uacf7_star_rating */ public function add_shortcodes() { wpcf7_add_form_tag( array('uacf7_star_rating','uacf7_star_rating*'), array( $this, 'uacf7_star_rating_cb' ), true ); } /* * Field: Post title */ public function uacf7_star_rating_cb($tag){ ob_start(); $validation_error = wpcf7_get_validation_error( $tag->name ); $class = wpcf7_form_controls_class( $tag->type ); if ( $validation_error ) { $class .= ' wpcf7-not-valid'; } $atts = array(); $class .= ' uacf7-rating'; $atts['class'] = $class; if ( $tag->is_required() ) { $atts['aria-required'] = 'true'; } if ( $validation_error ) { $atts['aria-describedby'] = wpcf7_get_validation_error_reference( $tag->name ); } $rating_style = $tag->values; $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; $atts = wpcf7_format_atts( $atts ); $selected = !empty($tag->get_option('selected', '', true)) ? $tag->get_option('selected', '', true) : '5'; $selected = $tag->get_option('selected', '', true); $star1 = !empty($tag->get_option('star1', '', true)) ? $tag->get_option('star1', '', true) : '1'; $star2 = !empty($tag->get_option('star2', '', true)) ? $tag->get_option('star2', '', true) : '2'; $star3 = !empty($tag->get_option('star3', '', true)) ? $tag->get_option('star3', '', true) : '3'; $star4 = !empty($tag->get_option('star4', '', true)) ? $tag->get_option('star4', '', true) : '4'; $star5 = !empty($tag->get_option('star5', '', true)) ? $tag->get_option('star5', '', true) : '5'; $rating_icon = ''; if( function_exists('uacf7_rating_icon') ) { if( !empty(uacf7_rating_icon($tag)) ) { $rating_icon = uacf7_rating_icon($tag); } }else { $get_icon = $tag->get_option('icon', '', true); switch ($get_icon) { case 'star1': $rating_icon = ''; break; case 'star2': $rating_icon = '✪'; break; } } ?> >
documentation' ); ?>




(Pro)
(Pro)