\Kendo\UI\Editor

A PHP wrapper for Kendo UI Editor.

Inherits from \Kendo\UI\Widget.

Usage

To use Editor in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo Editor

<?php
// Create a new instance of Editor and specify its id
$editor = new \Kendo\UI\Editor('Editor');

// Configure it
$editor->domain('value')

// Output it

echo $editor->render();
?>

Methods

change

Fires when Editor is blurred and its content has changed. For additional information check the change event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->change('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onChange(e) {
        // handle the change event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->change('onChange');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

content

Sets the HTML content of the Editor.

Returns

Editor

$value string

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->content('<strong>Content</strong>');
?>

deserialization

Fine-tune deserialization in the Editor widget. Deserialization is the process of parsing the HTML string input from the value() method or from the viewHtml dialog into editable content.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorDeserialization|array

Example - using \Kendo\UI\EditorDeserialization

<?php
$editor = new \Kendo\UI\Editor('Editor');
$deserialization = new \Kendo\UI\EditorDeserialization();
$custom = new \Kendo\JavaScriptFunction('function() { }');
$deserialization->custom($custom);
$editor->deserialization($deserialization);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$custom = new \Kendo\JavaScriptFunction('function() { }');
$editor->deserialization(array('custom' => $custom));
?>

domain

Relaxes the same-origin policy when using the iframe-based editor. This is done automatically for all cases except when the policy is relaxed by document.domain = document.domain. In that case, this property must be used to allow the editor to function properly across browsers. This property has been introduced in internal builds after 2014.1.319.

Returns

\Kendo\UI\Editor

Parameters

$value string

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->domain('value');
?>

encoded

Indicates whether the Editor should submit encoded HTML tags. By default, the submitted value is encoded.

Returns

\Kendo\UI\Editor

Parameters

$value boolean

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->encoded(true);
?>

endContent

Stops output bufferring and sets the preceding markup as the content of the Editor.

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->startContent();
?>
<strong>Content</strong>
<?php
$editor->endContent(); // content is set to <strong>Content</strong>
?>

execute

Fires when an Editor command is executed. For additional information check the execute event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->execute('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onExecute(e) {
        // handle the execute event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->execute('onExecute');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->execute(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

fileBrowser

Configuration for file browser dialog.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorFileBrowser|array

Example - using \Kendo\UI\EditorFileBrowser

<?php
$editor = new \Kendo\UI\Editor('Editor');
$fileBrowser = new \Kendo\UI\EditorFileBrowser();
$fileTypes = 'value';
$fileBrowser->fileTypes($fileTypes);
$editor->fileBrowser($fileBrowser);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$fileTypes = 'value';
$editor->fileBrowser(array('fileTypes' => $fileTypes));
?>

imageBrowser

Configuration for image browser dialog.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorImageBrowser|array

Example - using \Kendo\UI\EditorImageBrowser

<?php
$editor = new \Kendo\UI\Editor('Editor');
$imageBrowser = new \Kendo\UI\EditorImageBrowser();
$fileTypes = 'value';
$imageBrowser->fileTypes($fileTypes);
$editor->imageBrowser($imageBrowser);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$fileTypes = 'value';
$editor->imageBrowser(array('fileTypes' => $fileTypes));
?>

immutables

If enabled, the editor disables the editing and command execution in elements marked with editablecontent="false" attribute.

Returns

\Kendo\UI\Editor

Parameters

$value boolean|\Kendo\UI\EditorImmutables|array

Example - using boolean

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->immutables(true);
?>

Example - using \Kendo\UI\EditorImmutables

<?php
$editor = new \Kendo\UI\Editor('Editor');
$immutables = new \Kendo\UI\EditorImmutables();
$serialization = 'value';
$immutables->serialization($serialization);
$editor->immutables($immutables);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$serialization = 'value';
$editor->immutables(array('serialization' => $serialization));
?>

keydown

Fires when the user depresses a keyboard key. Triggered multiple times if the user holds the key down. For additional information check the keydown event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->keydown('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onKeydown(e) {
        // handle the keydown event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->keydown('onKeydown');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->keydown(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

keyup

Fires when the user releases a keyboard key. For additional information check the keyup event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->keyup('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onKeyup(e) {
        // handle the keyup event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->keyup('onKeyup');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->keyup(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

messages

Defines the text of the labels that are shown within the editor. Used primarily for localization.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorMessages|array

Example - using \Kendo\UI\EditorMessages

<?php
$editor = new \Kendo\UI\Editor('Editor');
$messages = new \Kendo\UI\EditorMessages();
$accessibilityTab = 'value';
$messages->accessibilityTab($accessibilityTab);
$editor->messages($messages);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$accessibilityTab = 'value';
$editor->messages(array('accessibilityTab' => $accessibilityTab));
?>

If set to true this configuration option would enable Tab-based navigation among Editor ToolBar items. By default navigation is arrow-based.

Returns

\Kendo\UI\Editor

Parameters

$value boolean

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->navigateOnTab(true);
?>

paste

Fires before the content is pasted in the Editor. For additional information check the paste event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->paste('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onPaste(e) {
        // handle the paste event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->paste('onPaste');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->paste(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

pasteCleanup

Options for controlling how the pasting content is modified before it is added in the editor.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorPasteCleanup|array

Example - using \Kendo\UI\EditorPasteCleanup

<?php
$editor = new \Kendo\UI\Editor('Editor');
$pasteCleanup = new \Kendo\UI\EditorPasteCleanup();
$all = true;
$pasteCleanup->all($all);
$editor->pasteCleanup($pasteCleanup);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$all = true;
$editor->pasteCleanup(array('all' => $all));
?>

pdf

Configures the Kendo UI Editor PDF export settings.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorPdf|array

Example - using \Kendo\UI\EditorPdf

<?php
$editor = new \Kendo\UI\Editor('Editor');
$pdf = new \Kendo\UI\EditorPdf();
$author = 'value';
$pdf->author($author);
$editor->pdf($pdf);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$author = 'value';
$editor->pdf(array('author' => $author));
?>

pdfExport

Fired when the user clicks the "Export to PDF" toolbar button. For additional information check the pdfExport event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->pdfExport('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onPdfExport(e) {
        // handle the pdfExport event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->pdfExport('onPdfExport');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->pdfExport(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

placeholder

The hint displayed by the widget when it is empty. Not set by default.

Returns

\Kendo\UI\Editor

Parameters

$value string

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->placeholder('value');
?>

resizable

If enabled, the editor renders a resize handle to allow users to resize it.

Returns

\Kendo\UI\Editor

Parameters

$value boolean|\Kendo\UI\EditorResizable|array

Example - using boolean

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->resizable(true);
?>

Example - using \Kendo\UI\EditorResizable

<?php
$editor = new \Kendo\UI\Editor('Editor');
$resizable = new \Kendo\UI\EditorResizable();
$content = true;
$resizable->content($content);
$editor->resizable($resizable);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$content = true;
$editor->resizable(array('content' => $content));
?>

select

Fires when the Editor selection has changed. For additional information check the select event documentation.

Returns

\Kendo\UI\Editor

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->select('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onSelect(e) {
        // handle the select event.
    }
</script>
<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->select('onSelect');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->select(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

serialization

Allows setting of serialization options.

Returns

\Kendo\UI\Editor

Parameters

$value \Kendo\UI\EditorSerialization|array

Example - using \Kendo\UI\EditorSerialization

<?php
$editor = new \Kendo\UI\Editor('Editor');
$serialization = new \Kendo\UI\EditorSerialization();
$entities = true;
$serialization->entities($entities);
$editor->serialization($serialization);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$entities = true;
$editor->serialization(array('entities' => $entities));
?>

startContent

Starts output bufferring. Any following markup will be set as the content of the Editor.

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->startContent();
?>
<strong>Content</strong>
<?php
$editor->endContent(); // content is set to <strong>Content</strong>
?>

stylesheets

Allows custom stylesheets to be included within the editing area. This setting is applicable only when the Editor is initialized from a textarea and a contenteditable iframe is generated.

Returns

\Kendo\UI\Editor

Parameters

$value array

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->stylesheets(array());
?>

tag

The tag that will be rendered. Defaults to "textarea". Triggers the inline edit mode if different.

Returns

\Kendo\UI\Editor

Parameters

$value string

Example

<?php
$editor = new \Kendo\UI\Editor('Editor');
$editor->tag('value');
?>

addTool

Adds one or more EditorTool to the Editor.

Returns

\Kendo\UI\Editor

Parameters

$value[, $value2, ...] \Kendo\UI\EditorTool|array

Example - using \Kendo\UI\EditorTool

<?php
$editor = new \Kendo\UI\Editor('Editor');
$tool = new \Kendo\UI\EditorTool();
$columns = 1;
$tool->columns($columns);
$editor->addTool($tool);
?>

Example - using array

<?php
$editor = new \Kendo\UI\Editor('Editor');
$columns = 1;
$editor->addTool(array('columns' => $columns));
?>

Example - adding more than one EditorTool

<?php
$editor = new \Kendo\UI\Editor('Editor');
$first  = new \Kendo\UI\EditorTool();
$second = new \Kendo\UI\EditorTool();
$editor->addTool($first, $second);
?>
In this article
Not finding the help you need?