asinfotrack / yii2-article
Yii2-article is a module offering basic CMS-functionality
Installs: 581
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 8
Forks: 2
Open Issues: 5
Type:yii2-extension
Requires
- php: >=7.1.0
- asinfotrack/yii2-toolbox: ~1.0.0
- creocoder/yii2-nested-sets: ~0.9.0
- yiisoft/yii2: ~2.0.6
- yiisoft/yii2-bootstrap: ~2.0.0
- yiisoft/yii2-jui: ~2.0.0
- dev-master
- 1.0.2
- 1.0.1
- 1.0.0
- 0.8.20
- 0.8.19
- 0.8.18
- 0.8.17
- 0.8.16
- 0.8.15
- 0.8.14
- 0.8.13
- 0.8.12
- 0.8.11
- 0.8.10
- 0.8.9
- 0.8.8
- 0.8.7
- 0.8.6
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- dev-dependabot/npm_and_yarn/debug-and-grunt-contrib-watch-3.2.7
- dev-dependabot/npm_and_yarn/qs-and-grunt-contrib-watch-6.11.0
- dev-dependabot/npm_and_yarn/minimatch-and-grunt-and-grunt-contrib-watch-3.0.8
- dev-dependabot/npm_and_yarn/grunt-1.5.3
- dev-dependabot/composer/yiisoft/yii2-2.0.38
- dev-feature/menu
This package is auto-updated.
Last update: 2024-11-11 01:59:27 UTC
README
Yii2-article is a lightweight cms extension
Installation
Basic installation
The preferred way to install this extension is through composer.
Either run
$ composer require asinfotrack/yii2-article
or add
"asinfotrack/yii2-article": "~1.0.1"
to the require
section of your composer.json
file.
Migration
After downloading you need to apply the migration creating the required tables:
yii migrate --migrationPath=@vendor/asinfotrack/yii2-article/migrations
To remove the table just do the same migration downwards.
Add the module to the yii-config
'modules'=>[ //your other modules... 'article'=>[ 'class'=>'asinfotrack\yii2\article\Module', 'userRelationCallback'=>function ($model, $attribute) { return $model->hasOne('app\models\User', ['id'=>$attribute]); }, 'backendArticleAccessControl' = [ 'class'=>'yii\filters\AccessControl', 'rules'=>[ ['allow'=>true, 'roles'=>['@']], ], ], 'backendArticleCategoryAccessControl' = [ 'class'=>'yii\filters\AccessControl', 'rules'=>[ ['allow'=>true, 'roles'=>['@']], ], ], 'components'=>[ //configuration of the renderer 'renderer'=>[ 'class'=>'asinfotrack\yii2\article\components\ArticleRenderer', 'addDataAttributesToArticleTagOptions'=>true, 'showDebugTags'=>false, 'placeholderCallbackMap'=>[ //example for a custom placeholder for an image tag 'img'=>function ($params) { return Html::img($params[0]); }, //your other custom placeholder tags here... ], ], ], ], ],
For a full list of options, see the attributes of the classes within the module. Especially check the classes
asinfotrack\yii2\article\Module
and asinfotrack\yii2\article\components\ArticleRenderer
. Some examples are
provided below.
Bootstrapping the module
This step is optional and only necessary when you want to use the ArticleAction
in a controller outside the actual
module.
Add the module to the bootstrap-array of your yii-config to ensure it is loaded when the third party controller
accesses the ArticleRender
. Make sure you use the same module-ID as you use in the step right above.
'bootstrap'=>['log', 'article'],