Interface yii\web\client\ClientScriptInterface
| Available since version | 22.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
| Method | Description | Defined By |
|---|---|---|
| getClientOptions() | Returns client-side options for the specified component. | yii\ |
| register() | Registers the client script for the specified widget and view. | yii\ |
Method Details
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 | ||
| $object | \ |
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;
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 ( \ | ||
| $object | \ |
The object whose client script is to be registered. |
| $view | yii\ |
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;
User Contributed Notes
Leave a comment
Join the conversation to share a note.