iserv4u / yii2-tii
A Yii2 extension to build widgets using templates, asset bundles and data pools.
Installs: 368
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:yii2-extension
This package has no released version yet, and little information is available.
README
!!! THIS PROJECT IS IN BETA STATE !!!
See repository clone on iServ4u GitLab
What is this?
Build dynamic templates and use them with data pools and asset bundles, build for use with Yii 2.0 Framework.
- A template injection interface
- build templates with assetbundle support
- create groups to stick items / widgets together
- define datapools for use within items / widgets
Installation
Via composer:
composer require iserv4u/yii2-tii:*
Configuration
Update your Yii2 application config:
$web = [
'modules' => [
'tii' => [
'class' => \iserv4u\tii\Module::class,
'adminPermission' => 'tii-module',
'requestParamName' => 'pageId',
'assetBundles' => [
\app\assets\MyAssetBundle::class => 'My Asset',
],
'widgetClasses' => [
\app\widgets\MyWidget::class => 'My Widget',
]
],
]
];
$console = [
'controllerMap' => [
'tii-data' => \iserv4u\tii\controllers\console\MysqlController::class,
],
];
Migrations
@iserv4u/tii/migrations
Recommendations
We recommend using pheme/yii2-settings
module to configure the assetBundles
and widgetClasses
from a user interface
Examples:
Settings for available asset bundles
Section: tii
Key: assetBundles
Type: object (JSON)
value: {"my\\assets\\ExampleAssetBundle":"Example Asset"}
Settings for available widget classes
Section: tii
Key: widgetClasses
Type: object (JSON)
value: {"my\\widget\\ExampleWidget":"Example Widget"}
Usage
Backend interface
-
Create a group
- and select a defined template
- or use a static widget class
- output group on any page in a tii cell container
-
Define a template
- define wrapper container
- provide a example item template
- add custom CSS and JavaScript, if needed
- optional: use with an custom assetbundle (instanceof
\yii\web\AssetBundle
)- define static $referenceUrl as link to asset docs reference rendered in template crud
-
Define a datapool
- use every application model (instance of
\yii\db\ActiveRecord
)
- use every application model (instance of
-
Create an item
- and assign it to a group
- see the example item template
- customize th item template
- add custom CSS and JavaScript, if needed
- optional: use a datapool and place its attributes to output in the item template
Frontend Cell
- Example output php
<?= iserv4u\tii\widgets\TiiCell::widget(['container_id' => 'name']) ?>
- Example output twig
{{ use ('iserv4u/tii/widgets/TiiCell') }} {{ tii_cell_widget( { 'container_id': 'name' }) }}
- Output selection of Tii- Groups
- by access_domain, route and request_param
- global output
Supported feature modules
-
dmstr/yii2-pages-module
>=0.14.0
-
iserv4u/yii2-pii
>=0.1.0
Features
-
Backend crud interface
- Tii overview page
- Output
- Template
- Datapool
- Group
- Item
- Tii overview page
-
TiiQueryBuilderInterface
- define custom query for a datapool
- implement in an active query model
-
Full RBAC support
-
TiiCell Widget
- to render output of a Tii group
- register custom assets (FileCache)
-
Use multi datapools in a group
-
Draggable widgets, move / sort tii groups between tii cells (drag & drop)
-
Edit Mode (toggle)
if (\Yii::$app->hasModule('tii')) {
echo Html::a('<i class="fa fa-eye"></i> Tii edit mode', '#', ['class' => 'tii-edit-control-toggle', 'title' => \Yii::t('tii', 'Enable / Disable Tii Edit Mode')]);
}
- Yii2 console command to dump your tii data:
yii tii-data/dump
RBAC
Available Roles:
- tii-module