: This article mainly introduces the Smarty encapsulation YII2Form form API-Switch. if you are interested in the PHP Tutorial, refer to it. Form element name: switch
Basic call format:
{Input type = 'switch' model = $ model field = 'is _ parent' value = '1' uncheck = '0' items = [0 = 'no, '1' => 'Yes']}
API description:
1. the switch type must be
2. the value specifies the value when the check is made. the default value is 1. the uncheck specifies the value when the check is canceled. the default value is 0.
3. items indicates the text above the switch. the type is array. The key corresponds to the value and uncheck attribute values, and the value corresponds to the displayed text.
4. the default items attribute is:
['0' => 'no', '1' => 'Yes']
:
The above introduces the Smarty encapsulation YII2 Form API-Switch, including some content, hope to be helpful to friends who are interested in PHP tutorials.