Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ All codexten packages documentation
* [Auth Module](yii-module-auth)
* [User Module](yii-module-user)
* [Country Module](yii-module-country)
* [Enquiry Module](yii-module-enquiry)
* [Geo Module](yii-module-geo)
* [Console App](yii-app-console)
180 changes: 180 additions & 0 deletions yii-module-enquiry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
Enquiry module for Yii 2.0 +
=========================

## Creating Module

#### Configurations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this section configuration


core.php

```
return [
'aliases' => [
'@moduleEnquiry' => '@codexten/yii/modules/enquiry',
],
];
```



moduleEnquiry.php

```
return [
'modules' => [
'enquiry' => [
'class' => Module::class,
'viewPath' => '@moduleEnquiry/views',
'controllerNamespace' => 'codexten\yii\modules\enquiry\controllers',
'controllerMap' => [
'enquiry' => [
'class' => CrudController::class,
'modelClass' => Enquiry::class,
],
],
],
],
];
```



add to composer.json

```
"config-plugin": {
"core": "config/core.php",
"moduleEnquiry": "config/moduleEnquiry.php",
"migrationNamespaces": "config/migrationNamespaces.php"
}
```



Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require --prefer-dist codexten/yii-module-enquiry:"^2.0.0"
```

or add

```json
"codexten/yii-module-enquiry": "~2.0.0",
```

to the require section of your composer.json.



Add $moduleEnquiry to admin and site of your composer.json.

```json
"config-plugin": {
"admin": [
"$moduleEnquiry",
],
"site": [
"$moduleEnquiry",
]
}
```

Configuration
-------------

admin config

```php

return \yii\helpers\ArrayHelper::merge(
// other configurations
[],
// $moduleEnquiry
[
'modules' => [
'enquiry' => [
'controllerMap' => [
'enquiry' => [
'enabledActions' => [
'index',
'view',
'delete',
],

],
],
],
],
]
);

```

site config

```php
return \yii\helpers\ArrayHelper::merge(
// other configurations
[],
// $moduleEnquiry
[
'components' => [
'urlManager' => [
'rules' => [
'/contact-us' => '/enquiry/enquiry/create',
],
],
'view' => [
'theme' => [
'pathMap' => [
'@moduleEnquiry/views' => [
'@gnt/site/modules/enquiry/views',
],
],
],
],
],
'modules' => [
'enquiry' => [
'controllerMap' => [
'enquiry' => [
'enabledActions' => [
'create',
],
],
],
],
],
]
);
```

## Override Views

path of create.php

​ site->modules->enquiry->views->enquiry->create
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use / instead of ->


```php
<?php $form = ActiveForm::begin() ?>

<?= $this->render('form/_fields', ['model' => $model, 'form' => $form]) ?>

<div class="form-group">

<?= Html::submitButton('Send', ['class' => 'btn btn-primary']) ?>

</div>

<?php ActiveForm::end() ?>
```

## customization

TBD