ReduxFramework_section

Main ReduxFramework_heading class.

Defined (1)

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

/library/admin/redux-framework/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'] ) && true === $this->field['indent'] ) { 
  38. $add_class = ' form-table-section-indented'; 
  39. } elseif( !isset( $this->field['indent'] ) || ( isset( $this->field['indent'] ) && false !== $this->field['indent'] ) ) { 
  40. $add_class = " hide"; 
  41.  
  42. echo '<input type="hidden" id="' . esc_attr($this->field['id']) . '-marker"></td></tr></table>'; 
  43.  
  44. echo '<div id="section-' . esc_attr($this->field['id']) . '" class="redux-section-field redux-field ' . esc_attr($this->field['style']) . ' ' . esc_attr($this->field['class']) . ' ">'; 
  45.  
  46. if ( ! empty( $this->field['title'] ) ) { 
  47. echo '<h3>' . esc_html($this->field['title']) . '</h3>'; 
  48.  
  49. if ( ! empty( $this->field['subtitle'] ) ) { 
  50. echo '<div class="redux-section-desc">' . esc_html($this->field['subtitle']) . '</div>'; 
  51.  
  52. echo '</div><table id="section-table-' . esc_attr($this->field['id']) . '" data-id="' . esc_attr($this->field['id']) . '" class="form-table form-table-section no-border' . esc_attr($add_class) . '"><tbody><tr><th></th><td id="' . esc_attr($guid) . '">'; 
  53.  
  54. // delete the tr afterwards 
  55. ?> 
  56. <script type="text/javascript"> 
  57. jQuery( document ).ready( 
  58. function() { 
  59. jQuery( '#<?php echo esc_js($this->field['id']); ?>-marker' ).parents( 'tr:first' ).css( {display: 'none'} ).prev('tr' ).css('border-bottom', 'none');; 
  60. var group = jQuery( '#<?php echo esc_js($this->field['id']); ?>-marker' ).parents( '.redux-group-tab:first' ); 
  61. if ( !group.hasClass( 'sectionsChecked' ) ) { 
  62. group.addClass( 'sectionsChecked' ); 
  63. var test = group.find( '.redux-section-indent-start h3' ); 
  64. jQuery.each( 
  65. test, function( key, value ) { 
  66. jQuery( value ).css( 'margin-top', '20px' ) 
  67. ); 
  68. if ( group.find( 'h3:first' ).css( 'margin-top' ) == "20px" ) { 
  69. group.find( 'h3:first' ).css( 'margin-top', '0' ); 
  70. ); 
  71. </script> 
  72. <?php 
  73.  
  74.  
  75. public function enqueue() { 
  76. if ( $this->parent->args['dev_mode'] ) { 
  77. wp_enqueue_style( 
  78. 'redux-field-section-css',  
  79. ReduxFramework::$_url . 'inc/fields/section/field_section.css',  
  80. array(),  
  81. time(),  
  82. 'all' 
  83. );