loveorigami / yii2-shortcodes-pack
Shortcodes collection as WP for Yii2
Installs: 911
Dependents: 1
Suggesters: 0
Security: 0
Stars: 24
Watchers: 4
Forks: 3
Open Issues: 6
Type:yii2-extension
Requires
This package is auto-updated.
Last update: 2024-11-29 04:30:39 UTC
README
Yii2-shortcodes-pack is part of the Yii2-plugins-system that have more usefull shortcodes for our site
0. Shortcodes in pack
and more in future releases...
How create my shortcode?
- It is very easy! See instruction
1. Download
Yii2-shortcodes-pack be installed using composer. Run following command to download and install Yii2-shortcodes-pack:
composer require "loveorigami/yii2-shortcodes-pack":"*"
2. Update database schema
The last thing you need to do is updating your database schema by applying the migrations. Make sure that you have properly configured db application component and run the following command:
$ php yii migrate/up --migrationPath=@vendor/loveorigami/yii2-plugins-system/migrations
3. Configure application
Let's start with defining module in @backend/config/main.php
:
'modules' => [ 'plugins' => [ 'class' => 'lo\plugins\Module', 'pluginsDir'=>[ '@lo/plugins/core', // default dir with core plugins '@lo/shortcodes' // dir with shortcodes pack '@common/shortcodes', // dir with our plugins with shortcodes ] ], ],
That's all, now you have module installed and configured in advanced template.
Next, open @frontend/config/main.php
and add following:
... 'components' => [ 'plugins' => [ 'class' => lo\plugins\components\PluginsManager::class, 'appId' => 1 // lo\plugins\BasePlugin::APP_FRONTEND, // by default 'enablePlugins' => true, 'shortcodesParse' => true, 'shortcodesIgnoreBlocks' => [ '<pre[^>]*>' => '<\/pre>', //'<div class="content[^>]*>' => '<\/div>', ] ], 'view' => [ 'class' => lo\plugins\components\View::class, ] ... ]
Also do the same thing with @backend/config/main.php
:
... 'components' => [ 'plugins' => [ 'class' => lo\plugins\components\PluginsManager::class, 'appId' => 2 // lo\plugins\BasePlugin::APP_BACKEND ], 'view' => [ 'class' => lo\plugins\components\View::class, ] ... ]