Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**! Create radio select param type vc.
- * ------------------------------------------------------------------------------------------------ */
- vc_add_shortcode_param( 'radio_select', 'kolyoum_radio_select_settings_field' );
- function kolyoum_radio_select_settings_field( $param, $value ) {
- $param_line = '';
- $param_line .= ( '<div class="radio-select-option '. esc_attr( $param['param_name'] ).' '. esc_attr($param['type']).'"><ul>' );
- foreach ( $param['value'] as $text_val => $val ) {
- if ( is_numeric( $text_val ) && ( is_string( $val ) || is_numeric( $val ) ) ) {
- $text_val = $val;
- }
- $text_val = esc_html__( $text_val, "kolyoum" );
- $selectd = $checked = '';
- if ( !is_array( $value ) ) {
- $param_value_arr = explode(',',$value );
- } else {
- $param_value_arr = $value;
- }
- if ( $value!=='' && in_array( $val, $param_value_arr ) ) {
- $checked = ' checked="checked"';
- $selectd = ' selectd';
- }
- $param_line .= ( '<li class="'. ( $text_val . $selectd ) .'">' );
- $param_line .= ( '<input type="radio" name="'. esc_attr( $param['param_name'] ) .'" class="'.$val.'" value="'. $val .'"'. $checked .' />' );
- $param_line .= ( '<a class="checkbox-select">' );
- $param_line .= ( '<span>'. ( $text_val ) .'</span></a></li>' );
- }
- $param_line .= ( '</ul></div>' );
- return $param_line;
- }
Add Comment
Please, Sign In to add comment