1. Go to this page and download the library: Download alex290/yii2-widget-content library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alex290 / yii2-widget-content example snippets
if (!$model->isNewRecord) :
endif
if ($model->getContent() != null) :
foreach ($model->getContent() as $widget) :
$element = $widget['model']; // Основной виджет
$element->type // Тип виджета для разделения секций
$elementItem = $widget['item']; // Элементы виджета
$data = Json::decode($element->data); // Поля виджета
if ($element->getImage()->getPrimaryKey() > 0) : // Вывод изображения
endif
if (!empty($elementItem)) :
foreach ($elementItem as $widgetItem) :
$dataItem = Json::decode($widgetItem->data); // Поля элемента виджета
if ($widgetItem->getImage()->getPrimaryKey() > 0) : // Вывод изображения
endif
endforeach
endif
endforeach
endif
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.