New to Telerik UI for PHP? Download free 30-day trial

\Kendo\UI\ColorGradient

A PHP wrapper for Kendo UI ColorGradient.

Inherits from \Kendo\UI\Widget.

Usage

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

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

// Configure it
$colorGradient->contrastTool(true)

// Output it

echo $colorGradient->render();
?>

Methods

change

Triggers when a new color has been selected. For additional information check the change event documentation.

Returns

\Kendo\UI\ColorGradient

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

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

Example - using string which defines a JavaScript name

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

Example - using \Kendo\JavaScriptFunction

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

contrastTool

Enables the contrast tool in the ColorGradient.

Returns

\Kendo\UI\ColorGradient

Parameters

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

Example - using boolean

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$colorGradient->contrastTool(true);
?>

Example - using \Kendo\UI\ColorGradientContrastTool

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$contrastTool = new \Kendo\UI\ColorGradientContrastTool();
$backgroundColor = 'value';
$contrastTool->backgroundColor($backgroundColor);
$colorGradient->contrastTool($contrastTool);
?>

Example - using array

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$backgroundColor = 'value';
$colorGradient->contrastTool(array('backgroundColor' => $backgroundColor));
?>

format

Sets the default input format in the gradient input editor.

Returns

\Kendo\UI\ColorGradient

Parameters

$value string

Example

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$colorGradient->format('value');
?>

formats

Sets the available input formats in the gradient input editor. Only "hex" and "rgb" are valid values.

Returns

\Kendo\UI\ColorGradient

Parameters

$value array

Example

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$colorGradient->formats(array());
?>

input

Whether to render the input.

Returns

\Kendo\UI\ColorGradient

Parameters

$value boolean

Example

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$colorGradient->input(true);
?>

messages

Allows customization labels and messages in the ColorGradient.

Returns

\Kendo\UI\ColorGradient

Parameters

$value \Kendo\UI\ColorGradientMessages|array

Example - using \Kendo\UI\ColorGradientMessages

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$messages = new \Kendo\UI\ColorGradientMessages();
$blue = 'value';
$messages->blue($blue);
$colorGradient->messages($messages);
?>

Example - using array

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$blue = 'value';
$colorGradient->messages(array('blue' => $blue));
?>

opacity

Specifies whether we should display the opacity slider to allow selection of transparency.

Returns

\Kendo\UI\ColorGradient

Parameters

$value boolean

Example

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$colorGradient->opacity(true);
?>

value

Specifies the initially selected color.

Returns

\Kendo\UI\ColorGradient

Parameters

$value string|

Example - using string

<?php
$colorGradient = new \Kendo\UI\ColorGradient('ColorGradient');
$colorGradient->value('value');
?>
In this article
Not finding the help you need?