HelPHP

Tinymce
in package

Tags
class

Tinymce

Provides integration and configuration utilities for the TinyMCE editor. Includes methods to get the required JavaScript and CSS, generate initialization options, produce initialization JavaScript, and handle file uploads from the editor.

Note that depending you main config file, you must set TINYMCE_UPLOAD to true to allow image upload in it. The default path then will be an "images" folder in your public/module_name/ folder depending the module executed.

if you want to change the upload url to make your own treatment, when you init H::input_textarea you can change its attribute like this : attributes['tinymce'] = array('images_upload_url'=>'your_path');

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.


        
On this page

Search results