\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

Fired when a message is posted to the chat widget. This can be either through the message box, or 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

Fired 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) { }'));
?>

typingEnd

Fired when the user clears the chat message box, signaling that he stopped typing. The event is also triggered when the user submits the currenlty 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

Fired 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 Kendo UI Chat user information.

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));
?>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy