ReduxFramework_color_gradient

Main ReduxFramework_color_gradient class.

Defined (1)

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

/inc/ReduxFramework/ReduxCore/inc/fields/color_gradient/field_color_gradient.php  
  1. class ReduxFramework_color_gradient { 
  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. // No errors please 
  25. $defaults = array( 
  26. 'from' => '',  
  27. 'to' => '' 
  28. ); 
  29.  
  30. $this->value = wp_parse_args( $this->value, $defaults ); 
  31.  
  32. echo '<div class="colorGradient"><strong>' . __( 'From ', 'redux-framework' ) . '</strong> '; 
  33. echo '<input data-id="' . $this->field['id'] . '" id="' . $this->field['id'] . '-from" name="' . $this->field['name'] . $this->field['name_suffix'] . '[from]' . '" value="' . $this->value['from'] . '" class="redux-color redux-color-init ' . $this->field['class'] . '" type="text" data-default-color="' . $this->field['default']['from'] . '" />'; 
  34. echo '<input type="hidden" class="redux-saved-color" id="' . $this->field['id'] . '-saved-color' . '" value="">'; 
  35.  
  36. if ( ! isset( $this->field['transparent'] ) || $this->field['transparent'] !== false ) { 
  37. $tChecked = ""; 
  38.  
  39. if ( $this->value['from'] == "transparent" ) { 
  40. $tChecked = ' checked="checked"'; 
  41.  
  42. echo '<label for="' . $this->field['id'] . '-from-transparency" class="color-transparency-check"><input type="checkbox" class="checkbox color-transparency ' . $this->field['class'] . '" id="' . $this->field['id'] . '-from-transparency" data-id="' . $this->field['id'] . '-from" value="1"' . $tChecked . '> ' . __( 'Transparent', 'redux-framework' ) . '</label>'; 
  43. echo "</div>"; 
  44. echo '<div class="colorGradient toLabel"><strong>' . __( 'To ', 'redux-framework' ) . '</strong> <input data-id="' . $this->field['id'] . '" id="' . $this->field['id'] . '-to" name="' . $this->field['name'] . $this->field['name_suffix'] . '[to]' . '" value="' . $this->value['to'] . '" class="redux-color redux-color-init ' . $this->field['class'] . '" type="text" data-default-color="' . $this->field['default']['to'] . '" />'; 
  45.  
  46. if ( ! isset( $this->field['transparent'] ) || $this->field['transparent'] !== false ) { 
  47. $tChecked = ""; 
  48.  
  49. if ( $this->value['to'] == "transparent" ) { 
  50. $tChecked = ' checked="checked"'; 
  51.  
  52. echo '<label for="' . $this->field['id'] . '-to-transparency" class="color-transparency-check"><input type="checkbox" class="checkbox color-transparency" id="' . $this->field['id'] . '-to-transparency" data-id="' . $this->field['id'] . '-to" value="1"' . $tChecked . '> ' . __( 'Transparent', 'redux-framework' ) . '</label>'; 
  53. echo "</div>"; 
  54.  
  55. /** 
  56. * Enqueue Function. 
  57. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css 
  58. * @since 1.0.0 
  59. * @access public 
  60. * @return void 
  61. */ 
  62. public function enqueue() { 
  63. wp_enqueue_script( 
  64. 'redux-field-color-gradient-js',  
  65. ReduxFramework::$_url . 'inc/fields/color_gradient/field_color_gradient' . Redux_Functions::isMin() . '.js',  
  66. array( 'jquery', 'wp-color-picker', 'redux-js' ),  
  67. time(),  
  68. true 
  69. ); 
  70.  
  71. redux_enqueue_style( 
  72. $this->parent,  
  73. 'redux-field-color_gradient-css',  
  74. ReduxFramework::$_url . 'inc/fields/color_gradient/field_color_gradient.css',  
  75. ReduxFramework::$_dir . 'inc/fields/color_gradient',  
  76. array(),  
  77. time(),  
  78. false 
  79. );  
  80.  
  81. // wp_enqueue_style( 
  82. // 'redux-field-color_gradient-css',  
  83. // ReduxFramework::$_url . 'inc/fields/color_gradient/field_color_gradient.css',  
  84. // time(),  
  85. // true 
  86. // );