0

Interface yii\web\client\ClientScriptInterface

Available since version22.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/web/client/ClientScriptInterface.php

Defines the contract for registering client-side scripts for widgets and components.

Classes implementing this interface are responsible for providing client options and registering scripts in the context of Yii2 widgets and views.

Public Methods

Hide inherited methods

Method Description Defined By
getClientOptions() Returns client-side options for the specified component. yii\web\client\ClientScriptInterface
register() Registers the client script for the specified widget and view. yii\web\client\ClientScriptInterface

Method Details

Hide inherited methods

getClientOptions() public abstract method

Returns client-side options for the specified component.

This method is used to retrieve the options that will be passed to the client-side script.

public abstract array getClientOptions ( \yii\web\client\T $object, array $options = [] )
$object \yii\web\client\T

The object for which to get the client options.

$options array

Additional options that may influence the client options returned.

return array

The client options for the widget or component.

                public function getClientOptions(BaseObject $object, array $options = []): array;

            
register() public abstract method

Registers the client script for the specified widget and view.

This method is used to register the necessary client-side scripts for the widget in the given view.

public abstract void register ( \yii\web\client\T $object, yii\web\View $view, array $options = [] )
$object \yii\web\client\T

The object whose client script is to be registered.

$view yii\web\View

The view in which the client script should be registered.

$options array

Additional options that may influence the script registration process.

                public function register(BaseObject $object, View $view, array $options = []): void;