Control: Datepicker - 10quality/wpmvc-addon-administrator GitHub Wiki

Control used as a field type to display a jQuery UI Datepicker.

Datepicker

Usage

// Namespace and use statement...

class Settings extends Model
{
    // Class properties...

    protected function init()
    {
        // Other properties...

        $this->tabs = [
            'tab_id' => [
                'fields' => [

                    'date' => [
                        'type' => 'datepicker',
                        'title' => __( 'Date' ),
                    ],

                    'custom_date' => [
                        'type' => 'datepicker',
                        'title' => __( 'Another date' ),
                        'control' => [
                            'attributes' => [
                                'data-date-format' => 'mm/dd/yy',
                                'data-show-button-panel' => 1,
                                'data-show-other-months' => 1,
                                'data-select-other-months' => 1,
                                'data-change-month' => 1,
                                'data-change-year' => 1,
                            ],
                        ],
                    ],

                    // Other fields...
                ],
            ],
        ];
    }
}

Control options

Control Data type Description
autocomplete bool HTML autocomplete option. Default: false
attributes array HTML attributes listed as an array. jQuery UI Datepicker options can be set as a data attribute.