Reference documentation and code samples for the Google Apps Chat V1 Client class SwitchControl.
Either a toggle-style switch or a checkbox inside a decoratedText widget.
Google Workspace add-ons and Chat
apps:
Only supported in the decoratedText widget.
Generated from protobuf message google.apps.card.v1.DecoratedText.SwitchControl
Namespace
Google \ Apps \ Card \ V1 \ DecoratedTextMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ name |
string
The name by which the switch widget is identified in a form input event. For details about working with form inputs, see Receive form data. |
↳ value |
string
The value entered by a user, returned as part of a form input event. For details about working with form inputs, see Receive form data. |
↳ selected |
bool
When |
↳ on_change_action |
Google\Apps\Card\V1\Action
The action to perform when the switch state is changed, such as what function to run. |
↳ control_type |
int
How the switch appears in the user interface. Google Workspace add-ons and Chat apps: |
getName
The name by which the switch widget is identified in a form input event.
For details about working with form inputs, see Receive form data.
| Returns | |
|---|---|
| Type | Description |
string |
|
setName
The name by which the switch widget is identified in a form input event.
For details about working with form inputs, see Receive form data.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getValue
The value entered by a user, returned as part of a form input event.
For details about working with form inputs, see Receive form data.
| Returns | |
|---|---|
| Type | Description |
string |
|
setValue
The value entered by a user, returned as part of a form input event.
For details about working with form inputs, see Receive form data.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getSelected
When true, the switch is selected.
| Returns | |
|---|---|
| Type | Description |
bool |
|
setSelected
When true, the switch is selected.
| Parameter | |
|---|---|
| Name | Description |
var |
bool
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getOnChangeAction
The action to perform when the switch state is changed, such as what function to run.
| Returns | |
|---|---|
| Type | Description |
Google\Apps\Card\V1\Action|null |
|
hasOnChangeAction
clearOnChangeAction
setOnChangeAction
The action to perform when the switch state is changed, such as what function to run.
| Parameter | |
|---|---|
| Name | Description |
var |
Google\Apps\Card\V1\Action
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getControlType
How the switch appears in the user interface.
| Returns | |
|---|---|
| Type | Description |
int |
Enum of type ControlType. |
setControlType
How the switch appears in the user interface.
| Parameter | |
|---|---|
| Name | Description |
var |
int
Enum of type ControlType. |
| Returns | |
|---|---|
| Type | Description |
$this |
|