2017 © Pedro Peláez
 

yii2-extension yii2-livecontent

Easy editing of site content for the Yii framework

image

sergeykoz/yii2-livecontent

Easy editing of site content for the Yii framework

  • Monday, June 20, 2016
  • by serga
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Live content extension for Yii 2

This extension provides easy way to make dynamic content of web application for Yii framework 2.0 applications., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require --prefer-dist sergeykoz/yii2-livecontent:0.1.0

or add, (*4)

"sergeykoz/yii2-livecontent": "~0.1.0"

to the require section of your composer.json file., (*5)

Updating database schema

After you downloaded sergeykoz/yii2-livecontent, you need to do is updating your database schema by applying the migrations:, (*6)

In command line:, (*7)

php yii migrate --migrationPath=@vendor/sergeykoz/yii2-livecontent/src/migrations

or configure controllerMap settings, (*8)

Configuration

Once the extension is installed, simply modify your application configuration as follows:, (*9)

return [
    'bootstrap' => ['livecontent'],
    'modules' => [
        'livecontent' => [
            'class' => 'ssoft\livecontent\Module',
            //'accessRules' => [[
            //    'allow' => true,
            //    'verbs' => ['POST']
            //]],
            //'editorOptions' => [
            //    'clientOptions'=>[
            //        'rows' => 6,
            //        'autoParagraph'=>false 
            //    ],
            //    'preset' => 'full',
            //    'autoParagraph' => true
            //]
        ],
        ...
    ],
    ...
];

Config file console.php, (*10)

return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'ssoft\livecontent\migrations'
            ],
        ],
    ],
];

Usage

In view ```php user->isGuest. For applications based on RBAC access you can use \Yii::$app->user->can('admin') blockLogic - the argument uses just for Content::block method which consists HTML template and fields to the template. */ echo Content::text('text-id-'.\Yii::$app->language, !Yii::$app->user->isGuest); ... echo Content::textarea('textblock-id', !Yii::$app->user->isGuest); // allowed to logged user ... echo Content::html('formatted-text-id', \Yii::$app->user->can('admin')); // allowed for RBAC role admin ... $block=[ 'template' => ", (*11)

{edit}

{head}

{description} {show_link on}

{caption}, (*12)

{/show_link on}
", 'rules'=> [ 'edit'=>['type'=>'editcontrol',], 'head' => ['name' => 'Title', 'type' => 'text', 'required' => true], 'description' => ['name' => 'Description', 'type' => 'html', 'required' => true], 'caption' => ['name' => 'Text', 'type'=>'text', 'required' => true], 'link' => ['name' => 'Link','type'=>'text'], 'show_link' => ['name' => 'Show a button','type'=>'checkbox', 'required' => true], 'button' => [ 'name' => 'Button type', 'type' => 'select', 'options'=>[ ['option'=>'Default', 'value' => 'btn-default'], ['option'=>'Primary', 'value' => 'btn-primary'], ['option'=>'Success', 'value' => 'btn-success'], ['option'=>'Info', 'value' => 'btn-info'], ['option'=>'Warning', 'value' => 'btn-warning'], ['option'=>'Danger', 'value' => 'btn-danger'], ], 'required' => true ], ] ]; echo Content::block('block-id', !Yii::$app->user->isGuest, $block); ?>

The Versions

20/06 2016

dev-master

9999999-dev

Easy editing of site content for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Kozin

yii2 content edit

20/06 2016

0.0.1

0.0.1.0

Easy editing of site content for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Kozin

yii2 content edit