Control: Select - 10quality/wpmvc-addon-administrator GitHub Wiki
Control used as a field type to display an HTML <select>
.
// Namespace and use statement...
class Settings extends Model
{
// Class properties...
protected function init()
{
// Other properties...
$this->tabs = [
'tab_id' => [
'fields' => [
'my_select' => [
'type' => 'select',
'title' => __( 'My select', 'my-domain' ),
'default' => 'b',
'options' => [
'a' => __( 'Option A', 'my-domain' ),
'b' => __( 'Option B', 'my-domain' ),
'c' => __( 'Option C', 'my-domain' ),
],
],
'auth' => [
'type' => 'select',
'title' => __( 'Authentication', 'my-domain' ),
'description' => __( 'Select description.', 'my-domain' ),
'options' => [
'basic' => __( 'Basic', 'my-domain' ),
'oauth' => __( 'OAuth', 'my-domain' ),
],
'control' => [
'wide' => true,
'add_empty' => true,
'empty_label' => __( '- No auth -', 'my-domain' ),
],
],
// Other fields...
],
],
];
}
}
Control | Data type | Description |
---|---|---|
wide |
bool |
Flag that indicates if the input should display wider or small. Default: false
|
add_empty |
bool |
Flag that indicates if an empty option should be added. Default: false
|
empty_label |
string |
Empty option label. Default: `` |