thefx/yii2-blocks

Blocks

Installs: 187

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0.0 2023-04-21 06:53 UTC

This package is auto-updated.

Last update: 2024-04-27 12:57:57 UTC


README

Installation

The preferred way to install this extension is through composer.

composer require thefx/yii2-blocks:dev-master

or add

"thefx/yii2-blocks": "dev-master"

to the require section of your composer.json file.

Apply Migrations

php yii migrate --migrationPath=@thefx/blocks/migrations

Modify your application configuration:

return [
    'modules' => [
        'blocks' => [
            'class' => 'thefx\blocks\Module',
            'layoutPath' => '@app/modules/admin/layouts',
            'layout' => 'page',
            'layoutPure' => 'pure',
            'rootUsers' => [1],
        ...
        ]
        ...
    ],
];

Add access only for auth users

    'as access blocks' => [
        'class' => 'yii\filters\AccessControl',
        'only' => ['pages/*', 'blocks/*'],
        'rules' => [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ],
    ],

Usage

Create block

http://site.com/blocks/block