https://github.com/dmstr/yii2-publication-module
A module for publications for Yii 2.0 Framework
https://github.com/dmstr/yii2-publication-module
Last synced: 11 months ago
JSON representation
A module for publications for Yii 2.0 Framework
- Host: GitHub
- URL: https://github.com/dmstr/yii2-publication-module
- Owner: dmstr
- Created: 2018-04-26T08:22:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T12:29:54.000Z (over 1 year ago)
- Last Synced: 2025-06-12T17:11:22.662Z (12 months ago)
- Language: PHP
- Size: 358 KB
- Stars: 7
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Yii2 Publication Module
=======================
A module for publications
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist dmstr/yii2-publication-module "*"
```
or add
```
"dmstr/yii2-publication-module": "*"
```
to the require section and
```
{
"type": "vcs",
"url": "https://git.hrzg.de/dmstr/yii2-publication-module.git"
}
```
to the repositories section of your `composer.json` file.
Configuration
-------------
Once the extension is installed, simply use it in your code by adding the two module to the module section of your config
```php
'modules' => [
'publication' => [
'class' => dmstr\modules\publication\Module::class,
'previewItemRole' => null // This describes a rbac role which allowed the user which has grants for this privilege to access the default detail action even if the item is not published
]
]
```
Run migrations from `@dmstr/modules/publication/migrations`.
Usage
-----
Create widget-templates `/widgets/crud/widget-template/index` for teaser
```
{
"title": "News Teaser",
"type": "object",
"properties": {
"teaser": {
"type": "string",
"title": "Teaser",
"default": "subline"
}
}
}
```
and content.
```
{
"title": "News Content",
"type": "object",
"properties": {
"content": {
"type": "string",
"title": "Content",
"default": "Content"
}
}
}
```
Create a category, ie. `News` and assign templates to it.
Create an item.
---
`publication/default/index?categoryId=1`
### Use variables from content schema in teaser template
```
{{ content.headline }}
{{ content.image }}
```