{"id":21754975,"url":"https://github.com/alex290/yii2-widget-content","last_synced_at":"2026-02-10T21:02:01.333Z","repository":{"id":56944314,"uuid":"316222874","full_name":"alex290/yii2-widget-content","owner":"alex290","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-18T08:08:03.000Z","size":2362,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T22:51:34.680Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alex290.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-26T12:21:56.000Z","updated_at":"2024-07-18T08:07:15.000Z","dependencies_parsed_at":"2025-04-13T11:02:02.206Z","dependency_job_id":null,"html_url":"https://github.com/alex290/yii2-widget-content","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/alex290/yii2-widget-content","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex290%2Fyii2-widget-content","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex290%2Fyii2-widget-content/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex290%2Fyii2-widget-content/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex290%2Fyii2-widget-content/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex290","download_url":"https://codeload.github.com/alex290/yii2-widget-content/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex290%2Fyii2-widget-content/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29316374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T20:44:44.282Z","status":"ssl_error","status_checked_at":"2026-02-10T20:44:43.393Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T09:16:08.663Z","updated_at":"2026-02-10T21:02:01.282Z","avatar_url":"https://github.com/alex290.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Widget content\n==============\nWidget content\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist alex290/yii2-widget-content \"*\"\n```\n\nor add\n\n```\n\"alex290/yii2-widget-content\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\n\nUsage\n-----\n\nOnce the extension is installed, simply use it in your code by  :\n\nПодключить внешне Ckeditor 5 classic\n\n    \u003cscript src=\"https://cdn.ckeditor.com/ckeditor5/39.0.1/classic/ckeditor.js\"\u003e\u003c/script\u003e\n\nИли скачать сборку и подключить по инструкции из документации Ckeditor https://ckeditor.com/docs/\n\nв конфиге web.php прописать\n\n    'modules' =\u003e [\n        'widget-content' =\u003e [\n            'class' =\u003e 'alex290\\widgetContent\\Module',\n            'path' =\u003e 'upload', //path to files\n        ],\n    ],\n\nrun migrate\n\nphp yii migrate/up --migrationPath=@vendor/alex290/yii2-widget-content/migrations\n\nattach behaviour to your model (be sure that your model has \"id\" property)\n\n    public function behaviors()\n    {\n        return [\n            'widget' =\u003e [\n                'class' =\u003e 'alex290\\widgetContent\\behaviors\\Behave',\n            ]\n        ];\n    }\n\n\nВывести виджет в админке\n\n    $widget = [\n        'text' =\u003e [\n            'name' =\u003e 'Текст',\n            'preview' =\u003e '/web/images/widget/header.png',\n            'fields' =\u003e [\n                'name' =\u003e ['string', 'max' =\u003e 255],\n                'text' =\u003e ['string'],\n                'image' =\u003e ['image'],\n            ]\n        ],\n\t\t...\n        'galery' =\u003e [ // Ключ уникальный поля \n            'name' =\u003e 'Галерея', // Название виджета\n            'preview' =\u003e '/web/images/widget/textImageTwo.png', // Путь к превьюшке\n            'fields' =\u003e [\n                'name' =\u003e ['string', 'max' =\u003e 255],  // Тип поля\n                'text' =\u003e ['string'], // Тип поля\n            ],\n            'item' =\u003e [ // Дополнительные поля (Например в галлереи несколько картинок)\n                'name' =\u003e ['string', 'max' =\u003e 255], \n                'image' =\u003e ['image'],\n            ]\n        ],\n    ];\n\n----------\n\nТипы полей:\n\n['string', 'max' =\u003e 255] - Текстовое поле\n\n['string'] - Текстовая область\n\n['integer'] - Целое число\n\n['image'] - Изображение\n\n['file'] - Файл \n\n['select'] - Список \n\n    ...\n    'category' =\u003e ['select', [\n        '44' =\u003e 'News',\n        '55' =\u003e 'Information',\n    ]], \n\n----------\n\n\n    \u003c?php if (!$model-\u003eisNewRecord) : ?\u003e\n    \t\t\u003c?= $model-\u003egetWidget($widget) ?\u003e\n    \u003c?php endif ?\u003e\n\nПолучить массив объектов виджетов данной модели\n\n    $model-\u003egetContent();\n\n\nУдалить виджеты\n\n    $model-\u003eremoveWidgetAll();\n\n    $model-\u003eremoveWidget($id);\n    \nВыводить записи на странице\n    \n    \u003c?php if ($model-\u003egetContent() != null) : ?\u003e\n        \u003c?php foreach ($model-\u003egetContent() as $widget) : ?\u003e\n            \u003cdiv class=\"row\"\u003e\n                \u003c?php\n                $element = $widget['model']; // Основной виджет\n\t\t$element-\u003etype // Тип виджета для разделения секций\n                $elementItem = $widget['item']; // Элементы виджета\n                $data = Json::decode($element-\u003edata); // Поля виджета\n                ?\u003e\n                \u003c?php if ($element-\u003egetImage()-\u003egetPrimaryKey() \u003e 0) : // Вывод изображения ?\u003e\n                    \u003cimg src=\"/web/\u003c?= $element-\u003egetImage()-\u003egetPath() ?\u003e\" alt=\"\"\u003e\n                \u003c?php endif ?\u003e\n                \u003c?php if (!empty($elementItem)) : ?\u003e\n                    \u003c?php foreach ($elementItem as $widgetItem) : ?\u003e\n                        \u003c?php $dataItem = Json::decode($widgetItem-\u003edata); // Поля элемента виджета  ?\u003e\n                        \u003c?php if ($widgetItem-\u003egetImage()-\u003egetPrimaryKey() \u003e 0) : // Вывод изображения ?\u003e\n                            \u003cimg src=\"/web/\u003c?= $widgetItem-\u003egetImage()-\u003egetPath() ?\u003e\" alt=\"\"\u003e\n                        \u003c?php endif ?\u003e\n                    \u003c?php endforeach ?\u003e\n                \u003c?php endif ?\u003e\n            \u003c/div\u003e\n        \u003c?php endforeach ?\u003e\n    \u003c?php endif ?\u003e\n    \nВывод файла\n\n    \u003ca href=\"/web/\u003c?= $data['file']['patch'] ?\u003e\" download=\"\u003c?= $data['file']['filename'] ?\u003e\"\u003eПоле с названием\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex290%2Fyii2-widget-content","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex290%2Fyii2-widget-content","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex290%2Fyii2-widget-content/lists"}