ReduxFramework_section

Main ReduxFramework_heading class.

Defined (1)

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

/inc/ReduxFramework/ReduxCore/inc/fields/section/field_section.php  
  1. class ReduxFramework_section { 
  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. public 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. // No errors please 
  25. $defaults = array( 
  26. 'indent' => '',  
  27. 'style' => '',  
  28. 'class' => '',  
  29. 'title' => '',  
  30. 'subtitle' => '',  
  31. ); 
  32. $this->field = wp_parse_args( $this->field, $defaults ); 
  33.  
  34. $guid = uniqid(); 
  35.  
  36. $add_class = ''; 
  37. if ( isset( $this->field['indent'] ) && ! empty( $this->field['indent'] ) ) { 
  38. $add_class = ' form-table-section-indented'; 
  39.  
  40. echo '<input type="hidden" id="' . $this->field['id'] . '-marker"></td></tr></table>'; 
  41.  
  42. echo '<div id="section-' . $this->field['id'] . '" class="redux-section-field redux-field ' . $this->field['style'] . $this->field['class'] . '">'; 
  43.  
  44. if ( ! empty( $this->field['title'] ) ) { 
  45. echo '<h3>' . $this->field['title'] . '</h3>'; 
  46.  
  47. if ( ! empty( $this->field['subtitle'] ) ) { 
  48. echo '<div class="redux-section-desc">' . $this->field['subtitle'] . '</div>'; 
  49.  
  50. echo '</div><table id="section-table-' . $this->field['id'] . '" class="form-table form-table-section no-border' . $add_class . '"><tbody><tr><th></th><td id="' . $guid . '">'; 
  51.  
  52. // delete the tr afterwards 
  53. ?> 
  54. <script type="text/javascript"> 
  55. jQuery( document ).ready( 
  56. function() { 
  57. jQuery( '#<?php echo $this->field['id']; ?>-marker' ).parents( 'tr:first' ).css({display: 'none'}); 
  58. ); 
  59. </script> 
  60. <?php 
  61.  
  62.  
  63. public function enqueue() { 
  64. redux_enqueue_style( 
  65. $this->parent,  
  66. 'redux-field-section-css',  
  67. ReduxFramework::$_url . 'inc/fields/section/field_section.css',  
  68. ReduxFramework::$_dir . 'inc/fields/section',  
  69. array(),  
  70. time(),  
  71. false 
  72. );  
  73.  
  74. // wp_enqueue_style( 
  75. // 'redux-field-section-css',  
  76. // ReduxFramework::$_url . 'inc/fields/section/field_section.css',  
  77. // time(),  
  78. // true 
  79. // );