code_editor
code_editor trait - Load CodeMirror and/or WP_editor html editor with consistant parameters
Tags
Table of Contents
- codeedit_enqueue() : void
- enqueue code mirror
- codeedit_get_codemirror() : string
- add code mirror textarea
- codeedit_get_wpeditor() : string
- add wp_editor
Methods
codeedit_enqueue()
enqueue code mirror
public
codeedit_enqueue([string $styles = '' ][, array<string|int, mixed> $options = [] ]) : void
Parameters
- $styles : string = ''
-
optional code editor styling
- $options : array<string|int, mixed> = []
-
optional code editor settings
Return values
void —codeedit_get_codemirror()
add code mirror textarea
public
codeedit_get_codemirror(string $name[, string $value = '' ][, string $type = 'html' ][, string $class = '' ][, string $attributes = '' ]) : string
Parameters
- $name : string
-
field name/id
- $value : string = ''
-
field value
- $type : string = 'html'
-
code editor type (js, css, html, php)
- $class : string = ''
-
optional class name(s)
- $attributes : string = ''
-
optional field attributes
Return values
string —textarea field
codeedit_get_wpeditor()
add wp_editor
public
codeedit_get_wpeditor(string $name[, string $value = '' ][, string $class = '' ][, string $wpoptions = [] ][, string $tinymce = [] ][, string $quicktags = [] ]) : string
Parameters
- $name : string
-
field name/id
- $value : string = ''
-
field value
- $class : string = ''
-
optional class name(s)
- $wpoptions : string = []
-
optional override wp_editor options
- $tinymce : string = []
-
optional override tinymce options
- $quicktags : string = []
-
optional override quicktags options
Return values
string —textarea field