name = 'wysiwyg'; $this->label = __( 'Wysiwyg Editor', 'cfs' ); // add the "code" button add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 20 ); } function html( $field ) { ?>
create_field( array( 'type' => 'select', 'input_name' => "cfs[fields][$key][options][formatting]", 'options' => array( 'choices' => array( 'default' => __( 'Default', 'cfs' ), 'none' => __( 'None (bypass filters)', 'cfs' ) ), 'force_single' => true, ), 'value' => $this->get_option( $field, 'formatting', 'default' ), ) ); ?> create_field( array( 'type' => 'true_false', 'input_name' => "cfs[fields][$key][options][required]", 'input_class' => 'true_false', 'value' => $this->get_option( $field, 'required' ), 'options' => array( 'message' => __( 'This is a required field', 'cfs' ) ), )); ?> =' ) ) { $plugins['code'] = CFS_URL . '/assets/js/tinymce/code.min.js'; } return $plugins; } function format_value_for_input( $value, $field = null ) { if ( version_compare( get_bloginfo( 'version' ), '4.3', '>=' ) ) { return format_for_editor( $value ); } else { return wp_richedit_pre( $value ); } } function format_value_for_api( $value, $field = null ) { $formatting = $this->get_option( $field, 'formatting', 'default' ); return ( 'none' == $formatting ) ? $value : apply_filters( 'the_content', $value ); } }