ReduxFramework_text

The Gravity Forms Advanced File Uploader ReduxFramework text class.

Defined (1)

The class is defined in the following location(s).

/inc/ReduxFramework/ReduxCore/inc/fields/text/field_text.php  
  1. class ReduxFramework_text { 
  2.  
  3. /** 
  4. * Field Constructor. 
  5. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function 
  6. * @since ReduxFramework 1.0.0 
  7. */ 
  8. function __construct( $field = array(), $value = '', $parent ) { 
  9. $this->parent = $parent; 
  10. $this->field = $field; 
  11. $this->value = $value; 
  12.  
  13. /** 
  14. * Field Render Function. 
  15. * Takes the vars and outputs the HTML for the field in the settings 
  16. * @since ReduxFramework 1.0.0 
  17. */ 
  18. function render() { 
  19. if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { 
  20. if ( empty( $this->field['args'] ) ) { 
  21. $this->field['args'] = array(); 
  22.  
  23. $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] ); 
  24. $this->field['class'] .= " hasOptions "; 
  25.  
  26. if ( empty( $this->value ) && ! empty( $this->field['data'] ) && ! empty( $this->field['options'] ) ) { 
  27. $this->value = $this->field['options']; 
  28.  
  29. //if (isset($this->field['text_hint']) && is_array($this->field['text_hint'])) { 
  30. $qtip_title = isset( $this->field['text_hint']['title'] ) ? 'qtip-title="' . $this->field['text_hint']['title'] . '" ' : ''; 
  31. $qtip_text = isset( $this->field['text_hint']['content'] ) ? 'qtip-content="' . $this->field['text_hint']['content'] . '" ' : ''; 
  32. //} 
  33.  
  34. $readonly = isset( $this->field['readonly'] ) ? ' readonly="readonly"' : ''; 
  35.  
  36. if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) { 
  37.  
  38. $placeholder = ''; 
  39. if ( isset( $this->field['placeholder'] ) ) { 
  40. $placeholder = $this->field['placeholder']; 
  41. }  
  42.  
  43. foreach ( $this->field['options'] as $k => $v ) { 
  44. if ( ! empty( $placeholder ) ) { 
  45. $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][ $k ] ) . '" ' : ''; 
  46.  
  47. echo '<div class="input_wrapper">'; 
  48. echo '<label for="' . $this->field['id'] . '-text-' . $k . '">' . $v . '</label> '; 
  49. echo '<input ' . $qtip_title . $qtip_text . 'type="text" id="' . $this->field['id'] . '-text-' . $k . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '[' . $k . ']' . '" ' . $placeholder . 'value="' . esc_attr( $this->value[ $k ] ) . '" class="regular-text ' . $this->field['class'] . '"' . $readonly . ' /><br />'; 
  50. echo '</div>'; 
  51. //foreach 
  52. } else { 
  53. $placeholder = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'] ) . '" ' : ''; 
  54. echo '<input ' . $qtip_title . $qtip_text . 'type="text" id="' . $this->field['id'] . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '" ' . $placeholder . 'value="' . esc_attr( $this->value ) . '" class="regular-text ' . $this->field['class'] . '"' . $readonly . ' />'; 
  55.  
  56. /** 
  57. * Enqueue Function. 
  58. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css 
  59. * @since ReduxFramework 3.0.0 
  60. */ 
  61. function enqueue() { 
  62. redux_enqueue_style( 
  63. $this->parent,  
  64. 'redux-field-text-css',  
  65. ReduxFramework::$_url . 'inc/fields/text/field_text.css',  
  66. ReduxFramework::$_dir . 'inc/fields/text',  
  67. array(),  
  68. time(),  
  69. false 
  70. );  
  71.  
  72. // wp_enqueue_style( 
  73. // 'redux-field-text-css',  
  74. // ReduxFramework::$_url . 'inc/fields/text/field_text.css',  
  75. // time(),  
  76. // true 
  77. // );