\Kendo\UI\Button

A PHP wrapper for Kendo UI Button.

Inherits from \Kendo\UI\Widget.

Usage

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

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

// Configure it
$button->badge(true)

// Output it

echo $button->render();
?>

Methods

badge

If set to true a default overlay badge will be displayed. If set to a string, an ovelay with content set to the specified string will be displayed. Can be set to a JavaScript object which represents the configuration of the Badge widget.

Returns

\Kendo\UI\Button

Parameters

$value boolean|string|float|\Kendo\UI\ButtonBadge|array

Example - using boolean

<?php
$button = new \Kendo\UI\Button('Button');
$button->badge(true);
?>

Example - using string

<?php
$button = new \Kendo\UI\Button('Button');
$button->badge('value');
?>

Example - using float

<?php
$button = new \Kendo\UI\Button('Button');
$button->badge(1);
?>

Example - using \Kendo\UI\ButtonBadge

<?php
$button = new \Kendo\UI\Button('Button');
$badge = new \Kendo\UI\ButtonBadge();
$align = 'value';
$badge->align($align);
$button->badge($badge);
?>

Example - using array

<?php
$button = new \Kendo\UI\Button('Button');
$align = 'value';
$button->badge(array('align' => $align));
?>

click

Fires when the Button is clicked with the mouse, touched on a touch device, or ENTER (or SPACE) is pressed while the Button is focused. For additional information check the click event documentation.

Returns

\Kendo\UI\Button

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$button = new \Kendo\UI\Button('Button');
$button->click('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onClick(e) {
        // handle the click event.
    }
</script>
<?php
$button = new \Kendo\UI\Button('Button');
$button->click('onClick');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$button = new \Kendo\UI\Button('Button');
$button->click(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

content

Sets the HTML content of the Button.

Returns

Button

$value string

Example

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

enable

Indicates whether the Button should be enabled or disabled. By default, it is enabled, unless a disabled="disabled" attribute is detected.

Returns

\Kendo\UI\Button

Parameters

$value boolean

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->enable(true);
?>

endContent

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

Example

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

fillMode

Controls how the color is applied to the button. Valid values are: "solid", "outline", "flat", "link", and "none". Default value is "solid".

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->fillMode('value');
?>

icon

Defines a name of an existing icon in the Kendo UI theme sprite. The icon will be applied as background image of a span element inside the Button. The span element can be added automatically by the widget, or an existing element can be used, if it has a k-icon CSS class applied. For a list of available icon names, please refer to the Icon Button article.

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->icon('value');
?>

iconClass

Defines a CSS class - or multiple classes separated by spaced - which are applied to a span element inside the Button. Allows the usage of custom icons.

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->iconClass('value');
?>

imageUrl

Defines a URL, which will be used for an img element inside the Button. The URL can be relative or absolute. In case it is relative, it will be evaluated with relation to the web page URL.The img element can be added automatically by the widget, or an existing element can be used, if it has a k-image CSS class applied.

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->imageUrl('value');
?>

rounded

Controls what border radius is applied to a button. Valid values are: "small", "medium", "large", "full", and "none". Default value is "medium".

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->rounded('value');
?>

size

Controls the overall physical size of a button. Valid values are: "small", "medium", "large", and "none". Default value is "medium".

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->size('value');
?>

spriteCssClass

Defines a CSS class (or multiple classes separated by spaces), which will be used for applying a background image to a span element inside the Button. In case you want to use an icon from the Kendo UI theme sprite background image, it is easier to use the icon property.The span element can be added automatically by the widget, or an existing element can be used, if it has a k-sprite CSS class applied.

Returns

\Kendo\UI\Button

Parameters

$value string

Example

<?php
$button = new \Kendo\UI\Button('Button');
$button->spriteCssClass('value');
?>

startContent

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

Example

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

themeColor

Controls the main color applied to the button. Valid values are: "base", "primary", "secondary", "tertiary", "info", "success", "warning", "error", "dark", "light", "inverse", and "none". Default value is "base".

Returns

\Kendo\UI\Button

Parameters

$value string

Example

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