2017 © Pedro Peláez
 

yii2-extension yii2-form-prefiller

Remember user-filled form data

image

insolita/yii2-form-prefiller

Remember user-filled form data

  • Friday, November 3, 2017
  • by Insolita
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Form assistant

Remember user-filled form data, prefill forms with remembered data Usefully for remember filter/sorting preferences, or make some sticky attributes, (*1)

Status, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

composer require --prefer-dist insolita/yii2-form-prefiller "~1.0"

or add, (*5)

"insolita/yii2-form-prefiller": "~0.0.1"

to the require section of your composer.json file., (*6)

Usage

Once the extension is installed, configure component :, (*7)

'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, (*8)

Remember $model data in storage, (*9)

   Yii::$app->prefiller->persist($model, new PrefillConfig([]));

Fill $model from storage, (*10)

  Yii::$app->prefiller->fillFromStorage($model, new PrefillConfig([
       'skipFromStorageAttributes'=>['someAttr'],
       'validateStorage'=>false
  ]));

Fill model from request->fillFromStorage->fillDefaults->persist if request update model, (*11)

  $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
  ]));

The Versions

03/11 2017

dev-master

9999999-dev

Remember user-filled form data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

extension yii2

03/11 2017

1.0.0

1.0.0.0

Remember user-filled form data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

extension yii2

03/06 2017

0.0.1

0.0.1.0

Remember user-filled form data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

extension yii2