Download the PHP package alex290/yii2-widget-content-old without Composer
On this page you can find all versions of the php package alex290/yii2-widget-content-old. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-widget-content-old
Widget content
Widget content
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
в конфиге web.php прописать
'modules' => [
'widget-content' => [
'class' => 'alex290\widgetContentOld\Module',
'path' => 'upload', //path to files
'ckeditorPath' => '/web/lib/ckeditor/ckeditor.js', // Путь к внешнему Ckeditor - Необязательно
'ckeditorConfig' => '/web/lib/ckeditor/config-st.js', // Путь к конфигурации внешнего Ckeditor - Необязательно
],
],
run migrate
php yii migrate/up --migrationPath=@vendor/alex290/yii2-widget-content/migrations
attach behaviour to your model (be sure that your model has "id" property)
public function behaviors()
{
return [
'widget' => [
'class' => 'alex290\widgetContentOld\behaviors\Behave',
]
];
}
Вывести виджет в админке
<?= $model->getWidget() ?>
Получить массив объектов виджетов данной модели
$model->getContent();
Удалить виджеты
$model->removeWidgetAll();
$model->removeWidget($id);
Выводить записи на странице
<!-- Выводим текст ($data['text']) -->
<!-- Выводим изображение -->
<!-- $widget->getImage()->GetPath() -->
<!-- Заголовок изображения ($data['title']) -->
<!-- Выводим файлы -->
<a href="/web/<?= $data['file'] ?>" download="<?= $data['fileName'] ?>"><?= $data['title'] ?></a>