ReduxFramework_editor

Main ReduxFramework_editor class.

Defined (1)

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

/library/admin/redux-framework/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. if ($this->parent->args['dev_mode']) { 
  55. wp_enqueue_style( 
  56. 'redux-field-editor-css',  
  57. ReduxFramework::$_url . 'inc/fields/editor/field_editor.css',  
  58. array(),  
  59. time(),  
  60. 'all' 
  61. ); 
  62.  
  63. wp_enqueue_script( 
  64. 'redux-field-editor-js',  
  65. ReduxFramework::$_url . 'inc/fields/editor/field_editor' . Redux_Functions::isMin() . '.js',  
  66. array( 'jquery', 'redux-js' ),  
  67. time(),  
  68. true 
  69. );