\Kendo\UI\Chat

A PHP wrapper for Kendo UI Chat.

Inherits from \Kendo\UI\Widget.

Usage

To use Chat 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 Chat

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

// Configure it
$chat->messages(new \Kendo\UI\ChatMessages())

// Output it

echo $chat->render();
?>

Methods

actionClick

Fired when an action button is clicked inside an attachment template or when a suggestedAction is clicked. For additional information check the actionClick event documentation.

Returns

\Kendo\UI\Chat

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->actionClick('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onActionClick(e) {
        // handle the actionClick event.
    }
</script>
<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->actionClick('onActionClick');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->actionClick(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

messages

Allows localization of the strings that are used in the widget.

Returns

\Kendo\UI\Chat

Parameters

$value \Kendo\UI\ChatMessages|array

Example - using \Kendo\UI\ChatMessages

<?php
$chat = new \Kendo\UI\Chat('Chat');
$messages = new \Kendo\UI\ChatMessages();
$placeholder = 'value';
$messages->placeholder($placeholder);
$chat->messages($messages);
?>

Example - using array

<?php
$chat = new \Kendo\UI\Chat('Chat');
$placeholder = 'value';
$chat->messages(array('placeholder' => $placeholder));
?>

post

Fires when a message is posted to the Chat. Can be either through the message box, or through an action button click. For additional information check the post event documentation.

Returns

\Kendo\UI\Chat

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->post('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onPost(e) {
        // handle the post event.
    }
</script>
<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->post('onPost');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->post(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

sendMessage

Fires when a message is posted through the Chat message box. For additional information check the sendMessage event documentation.

Returns

\Kendo\UI\Chat

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->sendMessage('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onSendMessage(e) {
        // handle the sendMessage event.
    }
</script>
<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->sendMessage('onSendMessage');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->sendMessage(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

toolClick

Fires when a button from the toolbar is clicked. For additional information check the toolClick event documentation.

Returns

\Kendo\UI\Chat

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->toolClick('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onToolClick(e) {
        // handle the toolClick event.
    }
</script>
<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->toolClick('onToolClick');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->toolClick(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

toolbar

Configures the toolbar of the Chat.

Returns

\Kendo\UI\Chat

Parameters

$value \Kendo\UI\ChatToolbar|array

Example - using \Kendo\UI\ChatToolbar

<?php
$chat = new \Kendo\UI\Chat('Chat');
$toolbar = new \Kendo\UI\ChatToolbar();
$animation = true;
$toolbar->animation($animation);
$chat->toolbar($toolbar);
?>

Example - using array

<?php
$chat = new \Kendo\UI\Chat('Chat');
$animation = true;
$chat->toolbar(array('animation' => $animation));
?>

typingEnd

Fires when the user clears the chat message box which signals that the user has stopped typing. The event is also triggered when the user submits the currently typed in message. For additional information check the typingEnd event documentation.

Returns

\Kendo\UI\Chat

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->typingEnd('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onTypingEnd(e) {
        // handle the typingEnd event.
    }
</script>
<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->typingEnd('onTypingEnd');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->typingEnd(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

typingStart

Fires when the user starts typing in the Chat message box. The event is fired only once and not upon each keystroke. For additional information check the typingStart event documentation.

Returns

\Kendo\UI\Chat

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->typingStart('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onTypingStart(e) {
        // handle the typingStart event.
    }
</script>
<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->typingStart('onTypingStart');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$chat = new \Kendo\UI\Chat('Chat');
$chat->typingStart(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

user

Configures the user information of the Chat.

Returns

\Kendo\UI\Chat

Parameters

$value \Kendo\UI\ChatUser|array

Example - using \Kendo\UI\ChatUser

<?php
$chat = new \Kendo\UI\Chat('Chat');
$user = new \Kendo\UI\ChatUser();
$iconUrl = 'value';
$user->iconUrl($iconUrl);
$chat->user($user);
?>

Example - using array

<?php
$chat = new \Kendo\UI\Chat('Chat');
$iconUrl = 'value';
$chat->user(array('iconUrl' => $iconUrl));
?>
In this article
Not finding the help you need?