\Kendo\UI\AIPrompt
A PHP wrapper for Kendo UI AIPrompt.
Inherits from \Kendo\UI\Widget.
Usage
To use AIPrompt 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 AIPrompt
<?php
// Create a new instance of AIPrompt and specify its id
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
// Configure it
$aIPrompt->activeView(1)
// Output it
echo $aIPrompt->render();
?>
Methods
activeView
Specifies the index of the active view or the name of the view.
Returns
\Kendo\UI\AIPrompt
Parameters
$value float|string
Example - using float
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->activeView(1);
?>
Example - using string
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->activeView('value');
?>
commandExecute
Triggered when a command item from the Commands view is clicked. The panel bar dataItem of the selected item is available through the event argument. For additional information check the commandExecute event documentation.
Returns
\Kendo\UI\AIPrompt
Parameters
$value string|\Kendo\JavaScriptFunction
Example - using string which defines a JavaScript function
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->commandExecute('function(e) { }');
?>
Example - using string which defines a JavaScript name
<script>
function onCommandExecute(e) {
// handle the commandExecute event.
}
</script>
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->commandExecute('onCommandExecute');
?>
Example - using \Kendo\JavaScriptFunction
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->commandExecute(new \Kendo\JavaScriptFunction('function(e) { }'));
?>
messages
The text messages displayed in the component. Use this option to customize or localize the messages.
Returns
\Kendo\UI\AIPrompt
Parameters
$value \Kendo\UI\AIPromptMessages|array
Example - using \Kendo\UI\AIPromptMessages
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$messages = new \Kendo\UI\AIPromptMessages();
$commandsView = 'value';
$messages->commandsView($commandsView);
$aIPrompt->messages($messages);
?>
Example - using array
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$commandsView = 'value';
$aIPrompt->messages(array('commandsView' => $commandsView));
?>
outputCopy
Triggered when the copy output button of an output is clicked. The prompt and the output object are available through the event argument. For additional information check the outputCopy event documentation.
Returns
\Kendo\UI\AIPrompt
Parameters
$value string|\Kendo\JavaScriptFunction
Example - using string which defines a JavaScript function
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->outputCopy('function(e) { }');
?>
Example - using string which defines a JavaScript name
<script>
function onOutputCopy(e) {
// handle the outputCopy event.
}
</script>
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->outputCopy('onOutputCopy');
?>
Example - using \Kendo\JavaScriptFunction
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->outputCopy(new \Kendo\JavaScriptFunction('function(e) { }'));
?>
outputRatingChange
Triggered when the rating of an output is changed through the rate buttons of an output. The output id and the new rating are available through the event argument. For additional information check the outputRatingChange event documentation.
Returns
\Kendo\UI\AIPrompt
Parameters
$value string|\Kendo\JavaScriptFunction
Example - using string which defines a JavaScript function
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->outputRatingChange('function(e) { }');
?>
Example - using string which defines a JavaScript name
<script>
function onOutputRatingChange(e) {
// handle the outputRatingChange event.
}
</script>
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->outputRatingChange('onOutputRatingChange');
?>
Example - using \Kendo\JavaScriptFunction
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->outputRatingChange(new \Kendo\JavaScriptFunction('function(e) { }'));
?>
addPromptOutput
Adds one or more AIPromptPromptOutput to the AIPrompt.
Returns
\Kendo\UI\AIPrompt
Parameters
$value[, $value2, ...] \Kendo\UI\AIPromptPromptOutput|array
Example - using \Kendo\UI\AIPromptPromptOutput
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$promptOutput = new \Kendo\UI\AIPromptPromptOutput();
$id = 'value';
$promptOutput->id($id);
$aIPrompt->addPromptOutput($promptOutput);
?>
Example - using array
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$id = 'value';
$aIPrompt->addPromptOutput(array('id' => $id));
?>
Example - adding more than one AIPromptPromptOutput
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$first = new \Kendo\UI\AIPromptPromptOutput();
$second = new \Kendo\UI\AIPromptPromptOutput();
$aIPrompt->addPromptOutput($first, $second);
?>
promptRequest
Triggered when the prompt view Generate output button is clicked. The prompt text is available through the event argument. Suitable to make a request to the AI service to receive an output. Use the addPromptOutput method to add the generated output to the promptOutputs collection.The prompt, outputand isRetry properties are available in the event argument. When the output is generated after clicking the retry button of an output, the isRetry property is true and the output property is the output content of the output card. For additional information check the promptRequest event documentation.
Returns
\Kendo\UI\AIPrompt
Parameters
$value string|\Kendo\JavaScriptFunction
Example - using string which defines a JavaScript function
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->promptRequest('function(e) { }');
?>
Example - using string which defines a JavaScript name
<script>
function onPromptRequest(e) {
// handle the promptRequest event.
}
</script>
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->promptRequest('onPromptRequest');
?>
Example - using \Kendo\JavaScriptFunction
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->promptRequest(new \Kendo\JavaScriptFunction('function(e) { }'));
?>
promptSuggestionItemTemplate
The template of the prompt suggestion item. It can be a string, a function or a Kendo Template.
Returns
\Kendo\UI\AIPrompt
Parameters
$value string|\Kendo\JavaScriptFunction
Example - using string
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->promptSuggestionItemTemplate('value');
?>
Example - using \Kendo\JavaScriptFunction
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->promptSuggestionItemTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>
promptSuggestions
An array of prompt suggestions as strings to display in the prompt view. The suggestions can be clicked to populate the prompt input.
Returns
\Kendo\UI\AIPrompt
Parameters
$value array
Example
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->promptSuggestions(array());
?>
showOutputRating
Specifies if the output rating should be displayed on the output card.
Returns
\Kendo\UI\AIPrompt
Parameters
$value boolean
Example
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$aIPrompt->showOutputRating(true);
?>
addToolbarItem
Adds one or more AIPromptToolbarItem to the AIPrompt.
Returns
\Kendo\UI\AIPrompt
Parameters
$value[, $value2, ...] \Kendo\UI\AIPromptToolbarItem|array
Example - using \Kendo\UI\AIPromptToolbarItem
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$toolbarItem = new \Kendo\UI\AIPromptToolbarItem();
$fillMode = 'value';
$toolbarItem->fillMode($fillMode);
$aIPrompt->addToolbarItem($toolbarItem);
?>
Example - using array
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$fillMode = 'value';
$aIPrompt->addToolbarItem(array('fillMode' => $fillMode));
?>
Example - adding more than one AIPromptToolbarItem
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$first = new \Kendo\UI\AIPromptToolbarItem();
$second = new \Kendo\UI\AIPromptToolbarItem();
$aIPrompt->addToolbarItem($first, $second);
?>
addView
Adds one or more AIPromptView to the AIPrompt.
Returns
\Kendo\UI\AIPrompt
Parameters
$value[, $value2, ...] \Kendo\UI\AIPromptView|array
Example - using \Kendo\UI\AIPromptView
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$view = new \Kendo\UI\AIPromptView();
$buttonIcon = 'value';
$view->buttonIcon($buttonIcon);
$aIPrompt->addView($view);
?>
Example - using array
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$buttonIcon = 'value';
$aIPrompt->addView(array('buttonIcon' => $buttonIcon));
?>
Example - adding more than one AIPromptView
<?php
$aIPrompt = new \Kendo\UI\AIPrompt('AIPrompt');
$first = new \Kendo\UI\AIPromptView();
$second = new \Kendo\UI\AIPromptView();
$aIPrompt->addView($first, $second);
?>