ReduxFramework_info

Main ReduxFramework_info class.

Defined (1)

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

/inc/ReduxFramework/ReduxCore/inc/fields/info/field_info.php  
  1. class ReduxFramework_info { 
  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 1.0.0 
  7. * @access public 
  8. * @return void 
  9. */ 
  10. function __construct( $field = array(), $value = '', $parent ) { 
  11. $this->parent = $parent; 
  12. $this->field = $field; 
  13. $this->value = $value; 
  14.  
  15. /** 
  16. * Field Render Function. 
  17. * Takes the vars and outputs the HTML for the field in the settings 
  18. * @since 1.0.0 
  19. * @access public 
  20. * @return void 
  21. */ 
  22. public function render() { 
  23.  
  24. $defaults = array( 
  25. 'title' => '',  
  26. 'desc' => '',  
  27. 'notice' => false,  
  28. 'style' => '' 
  29. ); 
  30. $this->field = wp_parse_args( $this->field, $defaults ); 
  31.  
  32. if ( empty( $this->field['desc'] ) && ! empty( $this->field['default'] ) ) { 
  33. $this->field['desc'] = $this->field['default']; 
  34. unset( $this->field['default'] ); 
  35.  
  36. if ( empty( $this->field['desc'] ) && ! empty( $this->field['subtitle'] ) ) { 
  37. $this->field['desc'] = $this->field['subtitle']; 
  38. unset( $this->field['subtitle'] ); 
  39.  
  40. if ( empty( $this->field['desc'] ) ) { 
  41. $this->field['desc'] = ""; 
  42.  
  43. if ( empty( $this->field['raw_html'] ) ) { 
  44. if ( $this->field['notice'] == true ) { 
  45. $this->field['class'] .= ' redux-notice-field'; 
  46. } else { 
  47. $this->field['class'] .= ' redux-info-field'; 
  48.  
  49. if ( empty( $this->field['style'] ) ) { 
  50. $this->field['style'] = 'normal'; 
  51.  
  52. $this->field['style'] = 'redux-' . $this->field['style'] . ' '; 
  53.  
  54. $indent = ( isset( $this->field['sectionIndent'] ) && $this->field['sectionIndent'] ) ? ' form-table-section-indented' : ''; 
  55.  
  56. echo '</td></tr></table><div id="info-' . $this->field['id'] . '" class="' . $this->field['style'] . $this->field['class'] . ' redux-field-' . $this->field['type'] . $indent . '">'; 
  57.  
  58. if ( ! empty( $this->field['raw_html'] ) && $this->field['raw_html'] ) { 
  59. echo $this->field['desc']; 
  60. } else { 
  61. if ( isset( $this->field['title'] ) && ! empty( $this->field['title'] ) ) { 
  62. $this->field['title'] = '<b>' . $this->field['title'] . '</b><br/>'; 
  63.  
  64. if ( isset( $this->field['icon'] ) && ! empty( $this->field['icon'] ) && $this->field['icon'] !== true ) { 
  65. echo '<p class="redux-info-icon"><i class="' . $this->field['icon'] . ' icon-large"></i></p>'; 
  66.  
  67. if ( isset( $this->field['raw'] ) && ! empty( $this->field['raw'] ) ) { 
  68. echo $this->field['raw']; 
  69.  
  70. if ( ! empty( $this->field['title'] ) || ! empty( $this->field['desc'] ) ) { 
  71. echo '<p class="redux-info-desc">' . $this->field['title'] . $this->field['desc'] . '</p>'; 
  72.  
  73. echo '</div><table class="form-table no-border" style="margin-top: 0;"><tbody><tr style="border-bottom:0;"><th style="padding-top:0;"></th><td style="padding-top:0;">'; 
  74.  
  75. /** 
  76. * Enqueue Function. 
  77. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css 
  78. * @since 1.0.0 
  79. * @access public 
  80. * @return void 
  81. */ 
  82. public function enqueue() { 
  83. redux_enqueue_style( 
  84. $this->parent,  
  85. 'redux-field-info-css',  
  86. ReduxFramework::$_url . 'inc/fields/info/field_info.css',  
  87. ReduxFramework::$_dir . 'inc/fields/info',  
  88. array(),  
  89. time(),  
  90. false 
  91. );  
  92.  
  93. // wp_enqueue_style( 
  94. // 'redux-field-info-css',  
  95. // ReduxFramework::$_url . 'inc/fields/info/field_info.css',  
  96. // time(),  
  97. // true 
  98. // );