PHP code example of gozoro / yii2-widgets

1. Go to this page and download the library: Download gozoro/yii2-widgets library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gozoro / yii2-widgets example snippets


<div style="width:200px;">
<?=Datepicker::widget(['name'=>'date', 'placeholder'=>'Date'])

<div style="width:200px;">
<?=Datepicker::widget([
	'name'=>'date',
	'placeholder' => 'Month',
	'readonly' => true,
	'style' => 'background:white;',
	'value' => '01.04.2024',
	'clientOptions'=>[
		'startDate' => '01.02.2024',
		'startView' => 1,
		'minViewMode' => 1,
		'todayBtn' => false,
		'todayHighlight' => false,
		'clearBtn' => true,
]])

<div style="width:400px">
<?=Datepicker::widget([
	'name'=>['dateBegin', 'dateEnd'],
	'value'=>['2024-05-01', '2024-05-10'],
	'placeholder'=>['begin date', 'end date'],
	'style'=>['color:red', 'color:blue'],
	'clientOptions'=>[
		'format'  =>'yyyy-mm-dd'
	]
])

<div style="width:400px">

<?=Autocompleter::widget([
	'name' => 'county',
	'items' => [
			"Afghanistan",
			"Albania",
			"Algeria",
			"Andorra",
			"Angola",
			"Antigua and Barbuda",
			"Argentina",
			"Armenia",
			"Australia",
			"Austria",
			"Azerbaijan"
		],
	'clientOptions'=>[
		'value' => 'function(item, index){return index;}'
		]
])

<div style="width:400px">

<?=Selector::widget([
	'name' => 'county',
	'items' => [
			"Afghanistan",
			"Albania",
			"Algeria",
			"Andorra",
			"Angola",
			"Antigua and Barbuda",
			"Argentina",
			"Armenia",
			"Australia",
			"Austria",
			"Azerbaijan"
		],
	'clientOptions'=>[
		'value' => 'function(item, index){return index;}'
		]
])

<div style="width:400px">
<?=MultiSelector::widget([
	'name' => 'countries[]',
	'items' => [
		"Afghanistan",
		"Albania",
		"Algeria",
		"Andorra",
		"Angola",
		"Antigua and Barbuda",
		"Argentina",
		"Armenia",
		"Australia",
		"Austria",
		"Azerbaijan"
	],

	'selection' => [1,2],
	'placeholder'=>'Enter countries',
])