Yii 2.0 Framework Widget Manager

Installs: 24 788

Dependents: 1

Suggesters: 0

Security: 0

Stars: 5

Watchers: 7

Forks: 6

Open Issues: 3


2.3.0 2021-10-08 07:10 UTC


Latest Stable Version Total Downloads License

Widget manager using twig templates


The preferred way to install this extension is through composer.

Either run

composer require dmstr/yii2-widgets2-module

to the require section of your composer.json file.


cd tests

docker-compose up -d

docker-compose run phpfpm bash


'modules => [
	'widgets' => [
		'class' => '\hrzg\widget\Module',
		'layout' => '@backend/views/layouts/main',
		'playgroundLayout' => '@frontend/views/layouts/main',
		'dateBasedAccessControl' => true,
		'datepickerMinutes' => false,
		'timezone' => 'Europe/Berlin'


availablePhpClasses availableFrontendPhpClasses - Templates with one of the listed classes in this setting will be outputed in cell widgets dropdown for available templates (default: hrzg\widget\widgets\TwigTemplate)


Once the extension is installed, simply use it in your code by :


Example with yii2-prototype-module

{{ use ('hrzg/widget/widgets') }}
{{ cell_widget({id: 'main'}) }}


  • Standard Twig widget hrzg\widget\widgets\TwigTemplate
  • Char-Rank ordering 001, 10, 5, aa1, aa1.2, b0 (not numeric)



Section: widgets

Key: availablePhpClasses

Type: JSON


{"hrzg\\widget\\widgets\\TwigTemplate": "Twig layout"}

Widget example


    "title": "Basic",
    "type": "object",
    "properties": {
        "headline": {
            "type": "string",
            "default": "Avo vole tioma profitanto ts,"
        "text_html": {
            "type": "string",
            "format": "html",
            "default": "Ja sub kiam aliu, fo unt fora danke helpverbo, dev bv tele kibi piedpilko.",
            "options": {
                "wysiwyg": true
<h2>{{ headline }}</h2>
<p>{{ text_html }}</p>

For more examples, please see the docs

Copy widgets

Console config

If you use the dmstr/yii2-pages-module >= 0.21.3, set pagesModule to true and the widget route and request_param will be recognized.

In case pagesModule to true

The copy process will only be successful if every widget which is placed on the default pages route /pages/default/page has the corresponding page object in the source language before copy. In short: If you have widgets in your database, placed on route = /pages/default/page and request_param = page id the page with that page id MUST exist. If not, the widget is an orphan and must be deleted before you are able to copy

'controllerMap'       => [
	'copy-widgets' => [
		'class' => '\hrzg\widget\commands\CopyController',
		'pagesModule' => true


Command: ./yii copy-widgets/language --sourceLanguage --destinationLanguage

Web UI

Url: /widgets/copy

RBAC permission


This permission means that the user is allowed to copy widgets between languages. Also used to enable the access_domain input for widget content with all available application languages.


  • Go to -> /widgets/copy
  • Select the source language (you can select the global domain if you have permissions to)
  • Select the target language (you can select the global domain if you have permissions to)
  • Start Copy


from 0.2 to 0.3

{{ cell_widget({id: 'header'}) }}


Available Permission items

Name Description
widgets_default_index Widgets Manager
widgets_crud_api Widgets CRUD API
widgets_crud_widget Widgets CRUD Content
widgets_crud_widget_copy Widgets CRUD Content Copy
widgets_crud_widget_create Widgets CRUD Content Create
widgets_crud_widget_delete Widgets CRUD Content Delete
widgets_crud_widget_index Widgets CRUD Content Index
widgets_crud_widget_update Widgets CRUD Content Update
widgets_crud_widget_view Widgets CRUD Content View
widgets_crud_widget-template Widgets CRUD Template
widgets_test Widgets TEST Playground
widgets_copy Widgets Language Copy
widgets-cell-edit Frontend editing
widgets Widgets Module


Section Key Value Type
widgets ckeditor.config
      "height": "4000px",
      "toolbar": [
        ["Link", "Image", "Table", "-", "NumberedList", "BulletedList", "-", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"],
        "/", ["Bold", "Italic", "Underline", "StrikeThrough", "-", "RemoveFormat", "-", "Undo", "Redo", "-", "Paste", "PasteText", "PasteFromWord", "-", "Cut", "Copy", "Find", "Replace", "-", "Outdent", "Indent", "-", "Print"]