skeeks/cms-rp-view-widget

Widget view model relited properties SkeekS CMS

Installs: 2 041

Dependents: 3

Suggesters: 0

Stars: 0

Watchers: 2

Forks: 0

Type:yii2-extension

1.0.3.1 2019-07-30 20:22 UTC

README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/cms-rp-view-widget "*"

or add

"skeeks/cms-rp-view-widget": "*"

Example


<? $widget = \skeeks\cms\rpViewWidget\RpViewWidget::beginWidget('product-properties', [
    'model' => $model,
    //'visible_properties' => ['color', 'material'],
    //'visible_only_has_values' => true,
    //'viewFile' => '@app/views/your-file',
]); ?>
    <? //$widget->viewFile = '';?>
<? \skeeks\cms\rpViewWidget\RpViewWidget::end(); ?>

View file


<?php
/* @var $this yii\web\View */
/* @var $widget \skeeks\cms\rpViewWidget\RpViewWidget */
?>
<? if ($attributes = $widget->rpAttributes) :  ?>
    <? foreach ($attributes as $code => $value) :  ?>
        <p>
            <strong><?= $widget->model->relatedPropertiesModel->getRelatedProperty($code)->name; ?>:</strong>
            <?= $widget->model->relatedPropertiesModel->getSmartAttribute($code); ?>
        </p>
    <? endforeach;  ?>
<? endif;  ?>

##Links

skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com