alexeevdv / yii2-shortcodes
Installs: 3 081
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 2
Type:yii2-extension
Requires
- alexeevdv/php-shortcodes: ~0.1.0
- yiisoft/yii2: ~2.0.0
Requires (Dev)
- codeception/codeception: ~2.4.0
- yiisoft/yii2-coding-standards: ~2.0.0
This package is auto-updated.
Last update: 2024-10-29 04:53:32 UTC
README
Yii2 behavior for rendering widgets with WordPress style shortcodes.
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require alexeevdv/yii2-shortcodes "~0.1.0"
or add
"alexeevdv/yii2-shortcodes": "~0.1.0"
to the require
section of your composer.json
file.
Configuration
use alexeevdv\yii\shortcodes\ShortcodeBehavior; //... 'components' => [ //... 'view' => [ 'as shortcodeBehavior' => ShortcodeBehavior::class, 'map' => [ 'feedback' => \frontend\widgets\ContactForm::class, 'gallery' => [ 'class' => \frontend\widgets\GalleryWidget::class, 'theme' => 'dark', ], ], ], //... ], //...
Usage
namespace frontend\widgets; class GalleryWidget extends \yii\base\Widget { public $id; public $theme; public function run() { // render your gallery here using $id and $theme } }
//Anywhere in your layouts, views or rendered content: [gallery id=413]