PHP code example of pceuropa / yii2-forms

1. Go to this page and download the library: Download pceuropa/yii2-forms 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/ */

    

pceuropa / yii2-forms example snippets


'modules' => [
    'forms' => [
          'class' => 'pceuropa\forms\Module',
     ],
]
 yii formsrbac/generate

'modules' => [
      'forms' => [
          'class' => 'pceuropa\forms\Module',
          'db' => 'db',
          'formsTable' => '{{%forms}}',
          'formDataTable' => 'form_',
          'sendEmail' => true, 
	  'testMode' => false, 
          'easyMode' => true,
          'emailSender' => '[email protected]',
          'rules' => [
                [
                    'actions' => [ 'update', 'delete', 'clone'],
                    'allow' => true,
                    'roles' => ['updateOwnForm'],   // rule only owner can edit form
                ],
                [
                    'actions' => ['user'],
                    'allow' => true,
                    'roles' => ['user'],     // role only authenticated user can see user's forms
                ],
                [
                    'actions' => ['create'],
                    'allow' => true,
                    'roles' => ['@'],        // role only logged user can create form
                ]
            ]
      ]
],

'components' => [
	  'authManager' => ['class' => 'yii\rbac\DbManager',],
]

  echo Form::widget([
     'formId' => 1, // equivalennt 'form' => FormModel::findOne(1)->body
  ]);