skeeks/cms-rp-view-widget

Widget view model relited properties SkeekS CMS

Installs: 3 353

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Type:yii2-extension

2.0.0.1 2023-06-05 10:45 UTC

This package is auto-updated.

Last update: 2024-11-05 14:06:16 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