mrstroz/yii2-wavecms

Yii2 WaveCMS

Installs: 242

Dependents: 5

Suggesters: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 1

Language:CSS

Type:yii2-extension

0.2.11 2019-04-12 07:52 UTC

README

Yii2 WaveCMS

It is recommended to install on Yii 2 Advanced Project Template

Installation

The preferred way to install this extension is through composer.

Run

composer require --prefer-source "mrstroz/yii2-wavecms" "~0.2.5"

or add

"mrstroz/yii2-wavecms": "~0.2.5"

to the require section of your composer.json file.

Required steps

  1. Update backend/config/main.php (Yii2 advanced template)
'modules' => [
    // ...   
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl']
    ],
],
// ...
'components' => [
    // ...
    'user' => [
        'identityClass' => 'mrstroz\wavecms\models\User', //Change identity class
        // ...
    ],
]
// ...
'controllerMap' => [
    'elfinder' => [
        'class' => 'mihaildev\elfinder\Controller',
        'access' => ['@'],
        'disabledCommands' => ['netmount'],
        'roots' => [
            [
                'baseUrl'=>'@frontWeb',
                'basePath'=>'@frontWebroot',
                'path' => 'userfiles',
                'name' => 'Files'
            ]
        ]
    ]
]
  1. Uncomment urlManager section in backend/config/main.php and add .htaccess

  2. Update common/config/main.php (Yii2 advanced template)

'components' => [
    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
]
  1. Run migration

Add the migrationPath in console/config/main.php and run yii migrate:

// Add migrationPaths to console config:
'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationPath' => [
            '@app/migrations',
            '@yii/rbac/migrations/',
            '@yii/i18n/migrations/',
            '@vendor/mrstroz/yii2-wavecms/migrations/',
            '@vendor/yii2mod/yii2-settings/migrations/'    
        ],
    ],
],

Or run migrates directly

yii migrate --migrationPath=@yii/rbac/migrations
yii migrate --migrationPath=@yii/i18n/migrations/
yii migrate --migrationPath=@vendor/mrstroz/yii2-wavecms/migrations
yii migrate --migrationPath=@vendor/yii2mod/yii2-settings/migrations
  1. Update console/config/main.php (Yii2 advanced template)
'modules' => [
    // ...
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module'
    ],
],
  1. Add new WaveCMS user
yii wavecms/create [email] [password]

Overriding classes

Classes can be overridden by:

  1. classMap attribute for WaveCMS module
'modules' => [
    // ...   
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl'],
        'classMap' => [
            'User' => \common\models\User::class
        ]
    ],
],
  1. Yii2 Dependency Injection configuration in backend/config/main.php
'container' => [
    'definitions' => [
        mrstroz\wavecms\models\User::class => common\models\User::class
    ],
],

Overriding controllers

Use controllerMap attribute for WaveCMS module to override controllers

'modules' => [
    // ...   
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl'],
        'controllerMap' => [
            'user' => 'backend\controllers\UserController'
        ]
    ],
],

Overriding views

Use themes for override views

'components' => [
    // ...
    'view' => [
        'theme' => [
            'basePath' => '@app/themes/basic',
            'baseUrl' => '@web/themes/basic',
            'pathMap' => [
                '@wavecms/views' => '@app/themes/basic/wavecms',
            ],
        ],
    ],
    // ...
],

Multilingual

  1. Many languages can be handle by yii2-localeurls. Follow all steps from Locale Urls installation.

  2. Set CMS languages in backend/config/main.php for WaveCMS module

'modules' => [
    // ...
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl']
    ],
    // ...
]
  1. Configure message sources see docs
'components' => [
    // ...
    'i18n' => [
        'translations' => [
            '*' => [
                'class' => 'yii\i18n\DbMessageSource',
            ],
        ],
    ],
],
  1. Use message command to add translations added in templates
yii message/config-template path/to/config.php
yii message path/to/config.php

Shared hosting

For shared hosting, copy and replace environments folder from vendor/mrstroz/wavecms and type php init. Frontend url: /public, Backend url: /public/admin

Available WaveCMS modules

Page (home page, text pages, menu) - https://github.com/mrstroz/yii2-wavecms-page

Example (example module) - https://github.com/mrstroz/yii2-wavecms-example

Form (form module) - https://github.com/mrstroz/yii2-wavecms-form

INWAVE LOGO
INWAVE - Internet Software House
inwave.eu