Guest User

Untitled

a guest
Apr 26th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2. /**! Create radio select param type vc.
  3. * ------------------------------------------------------------------------------------------------ */
  4. vc_add_shortcode_param( 'radio_select', 'kolyoum_radio_select_settings_field' );
  5. function kolyoum_radio_select_settings_field( $param, $value ) {
  6.  
  7. $param_line = '';
  8. $param_line .= ( '<div class="radio-select-option '. esc_attr( $param['param_name'] ).' '. esc_attr($param['type']).'"><ul>' );
  9.  
  10. foreach ( $param['value'] as $text_val => $val ) {
  11.  
  12. if ( is_numeric( $text_val ) && ( is_string( $val ) || is_numeric( $val ) ) ) {
  13. $text_val = $val;
  14. }
  15.  
  16. $text_val = esc_html__( $text_val, "kolyoum" );
  17. $selectd = $checked = '';
  18.  
  19. if ( !is_array( $value ) ) {
  20. $param_value_arr = explode(',',$value );
  21. } else {
  22. $param_value_arr = $value;
  23. }
  24.  
  25. if ( $value!=='' && in_array( $val, $param_value_arr ) ) {
  26. $checked = ' checked="checked"';
  27. $selectd = ' selectd';
  28. }
  29.  
  30. $param_line .= ( '<li class="'. ( $text_val . $selectd ) .'">' );
  31. $param_line .= ( '<input type="radio" name="'. esc_attr( $param['param_name'] ) .'" class="'.$val.'" value="'. $val .'"'. $checked .' />' );
  32. $param_line .= ( '<a class="checkbox-select">' );
  33. $param_line .= ( '<span>'. ( $text_val ) .'</span></a></li>' );
  34. }
  35.  
  36. $param_line .= ( '</ul></div>' );
  37.  
  38. return $param_line;
  39. }
Add Comment
Please, Sign In to add comment