Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (27) | Download .zip | Reputation | Support forum | Blog (1) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2022-10-10 (2 months ago) | Not yet rated by the users | Total: 17 This week: 1 | All time: 10,769 This week: 491 |
Version | License | PHP version | Categories | |||
yii2-form-prefiller 1.0 | MIT/X Consortium ... | 5 | PHP 5, User Management |
Remember user-filled form data, prefill forms with remembered data Usefully for remember filter/sorting preferences, or make some sticky attributes
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist insolita/yii2-form-prefiller "~1.0"
or add
"insolita/yii2-form-prefiller": "~0.0.1"
to the require section of your composer.json
file.
Once the extension is installed, configure component :
'components'=>[
'prefiller' => [
'class' => \insolita\prefiller\FormPrefiller::class,
'storage' => [
//one of storage types - db,session,cookie,redis supported
'class' => \insolita\prefiller\storages\CookieStorage::class,
],
],
]
Support ActiveRecord models,yii\base\Model,DummyModel
Remember $model data in storage
Yii::$app->prefiller->persist($model, new PrefillConfig([]));
Fill $model from storage
Yii::$app->prefiller->fillFromStorage($model, new PrefillConfig([
'skipFromStorageAttributes'=>['someAttr'],
'validateStorage'=>false
]));
Fill model from request->fillFromStorage->fillDefaults->persist if request update model
$filter = new DummyModel(['page','sort','sortOrder','searchQuery','viewMode']);
Yii::$app->prefiller->fill($filter, new PrefillConfig([
'method'=>'get',
'defaults'=>['sort'=>'price','sortOrder'=>'desc','viewMode'=>'grid']
'skipFromRequestAttributes'=>['searchQuery'],
'validateRequest'=>true
]));
Files |
File | Role | Description | ||
---|---|---|---|---|
src (3 files, 2 directories) | ||||
tests (4 files, 2 directories) | ||||
.scrutinizer.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | src |
File | Role | Description | ||
---|---|---|---|---|
contracts (3 files) | ||||
storages (6 files) | ||||
BasePrefiller.php | Class | Class source | ||
FormPrefiller.php | Class | Class source | ||
PrefillConfig.php | Class | Class source |
Files | / | src | / | contracts |
File | Role | Description |
---|---|---|
IFormPrefiller.php | Class | Class source |
IMemorableForm.php | Class | Class source |
IPrefillStorage.php | Class | Class source |
Files | / | src | / | storages |
File | Role | Description |
---|---|---|
BaseStorage.php | Class | Class source |
CookieStorage.php | Class | Class source |
DbStorage.php | Class | Class source |
RedisHashStorage.php | Class | Class source |
RedisStorage.php | Class | Class source |
SessionStorage.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
config (2 files) | ||||
unit (3 files) | ||||
.env | Data | Auxiliary data | ||
bootstrap.php | Example | Example script | ||
unit.suite.yml | Data | Auxiliary data | ||
yii | Example | Example script |
Files | / | tests | / | config |
File | Role | Description |
---|---|---|
base.php | Class | Class source |
console.php | Class | Class source |
Files | / | tests | / | unit |
File | Role | Description |
---|---|---|
bootstrap.php | Aux. | Auxiliary script |
DummyModel.php | Class | Class source |
FormPrefillerTest.php | Class | Class source |
yii2-form-prefiller-2022-10-10.zip 16KB | |
yii2-form-prefiller-2022-10-10.tar.gz 10KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.