ReduxFramework_editor

Main ReduxFramework_editor class.

Defined (1)

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

/inc/ReduxFramework/ReduxCore/inc/fields/editor/field_editor.php  
  1. class ReduxFramework_editor { 
  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. if ( ! isset( $this->field['args'] ) ) { 
  25. $this->field['args'] = array(); 
  26.  
  27. $this->field['args']['onchange_callback'] = "alert('here')"; 
  28.  
  29. // Setup up default args 
  30. $defaults = array( 
  31. 'textarea_name' => $this->field['name'] . $this->field['name_suffix'],  
  32. 'editor_class' => $this->field['class'],  
  33. 'textarea_rows' => 10, //Wordpress default 
  34. 'teeny' => true,  
  35. ); 
  36.  
  37. if ( isset( $this->field['editor_options'] ) && empty( $this->field['args'] ) ) { 
  38. $this->field['args'] = $this->field['editor_options']; 
  39. unset( $this->field['editor_options'] ); 
  40.  
  41. $this->field['args'] = wp_parse_args( $this->field['args'], $defaults ); 
  42.  
  43. wp_editor( $this->value, $this->field['id'], $this->field['args'] ); 
  44.  
  45.  
  46. /** 
  47. * Enqueue Function. 
  48. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css 
  49. * @since 1.0.0 
  50. * @access public 
  51. * @return void 
  52. */ 
  53. public function enqueue() { 
  54.  
  55. redux_enqueue_style( 
  56. $this->parent,  
  57. 'redux-field-editor-css',  
  58. ReduxFramework::$_url . 'inc/fields/editor/field_editor.css',  
  59. ReduxFramework::$_dir . 'inc/fields/editor',  
  60. array(),  
  61. time(),  
  62. false 
  63. );  
  64.  
  65. // wp_enqueue_style( 
  66. // 'redux-field-editor-css',  
  67. // ReduxFramework::$_url . 'inc/fields/editor/field_editor.css',  
  68. // time(),  
  69. // true 
  70. // ); 
  71.  
  72. wp_enqueue_script( 
  73. 'redux-field-editor2-js',  
  74. ReduxFramework::$_url . 'inc/fields/editor/field_editor' . Redux_Functions::isMin() . '.js',  
  75. array( 'jquery', 'redux-js' ),  
  76. time(),  
  77. true 
  78. ); 
  79.  
  80.  
  81.  
  82.  
  83.