Tinymce
in package
Tags
Table of Contents
Methods
- __construct() : mixed
- get_init_javascript() : string
- Generates the JavaScript code to initialize TinyMCE on a given DOM element.
- get_options_init() : array<string|int, mixed>
- Generates and returns the TinyMCE initialization options array.
- receive_file() : void
- Handles image file uploads from TinyMCE.
Methods
__construct()
public
__construct([mixed $dom_container = null ]) : mixed
Parameters
- $dom_container : mixed = null
get_init_javascript()
Generates the JavaScript code to initialize TinyMCE on a given DOM element.
public
static get_init_javascript(string $domID[, array<string|int, mixed>|null $options = null ]) : string
Parameters
- $domID : string
-
The DOM element ID to attach TinyMCE to.
- $options : array<string|int, mixed>|null = null
-
Optional. Additional TinyMCE options.
Return values
string —JavaScript code for TinyMCE initialization.
get_options_init()
Generates and returns the TinyMCE initialization options array.
public
static get_options_init(array<string|int, mixed> $options) : array<string|int, mixed>
Sets up plugins, toolbar, language, and other editor options.
Parameters
- $options : array<string|int, mixed>
-
Initial options to customize or extend.
Return values
array<string|int, mixed> —The complete TinyMCE options array.
receive_file()
Handles image file uploads from TinyMCE.
public
static receive_file(string $destinationFolder) : void
Validates the origin, file extension, and saves the uploaded file to the specified destination folder. Responds with a JSON object containing the file location or an error.
Parameters
- $destinationFolder : string
-
The folder where uploaded images should be saved.
Return values
void —Outputs JSON response and exits.