2017 © Pedro Peláez
 

project yii2-slider

Yii2 slider extension

image

abdualiym/yii2-slider

Yii2 slider extension

  • Wednesday, March 14, 2018
  • by Abdualiym
  • Repository
  • 2 Watchers
  • 0 Stars
  • 79 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

yii2-slider extension

The extension allows manage html content block., (*1)

Installation

  • Install with composer:
composer require abdualiym/yii2-slider "^1.0"
  • After composer install run console command for create tables:
php yii migrate/up --migrationPath=@vendor/abdualiym/yii2-slider/migrations
  • Setup in common config storage and language configurations. > language indexes related with database columns.

Admin panel tabs render by array values order., (*2)

Begin id param value from 0., (*3)

'modules' => [
    'slider' => [ // don`t change module key
        'class' => '@abdualiym\slider\Module',
        'storageRoot' => $params['staticPath'],
        'storageHost' => $params['staticHostInfo'],
        'thumbs' => [ // 'sm' and 'md' keys are reserved
            'admin' => ['width' => 128, 'height' => 128],
            'thumb' => ['width' => 320, 'height' => 320],
        ],
        'languages' => [
            'ru' => [
                'id' => 0,
                'name' => 'Русский',
            ],
            'uz' => [
                'id' => 1,
                'name' => 'O`zbek tili',
            ],
        ],
    ],
]
  • In admin panel add belove links for manage pages, article categories, articles and menu:
/slider/categories/index
/slider/slides/index?slug=your_category_slug_name
/slider/tags/index

For using SlidesController actions you must manual specify their category slug in route., (*4)

Examples

Extension registers next language arrays to Yii::$app->params[] for use in views:, (*5)

\Yii::$app->params['cms']['languageIds'][$prefix] = $language['id'];
[
    'en' => 2,
    'ru' => 1,
    ...
]

\Yii::$app->params['cms']['languages'][$prefix] = $language['name'];
[
    'en' => 'English',
    ...
]


\Yii::$app->params['cms']['languages2'][$language['id']] = $language['name'];
[
    2 => 'English',
    ...
]

Frontend widgets integration

get all slides by category slug, (*6)

abdualiym\slider\entities\Slides::getBySlug($slug)

get all slides count by category slug, (*7)

abdualiym\slider\entities\Slides::getBySlug($slug, true)

get all tags, (*8)

abdualiym\slider\entities\Tags::getAll()

get all tags count, (*9)

abdualiym\slider\entities\Tags::getAll(true)

Examples for use in frontend see yii2-language extension


TODO - Copy from extension root directory example widgets for frontend integration, (*10)

The Versions