GalleryWidget.php 1.62 KB
<?php
namespace backend\widgets\Gallery;

use common\components\GalleryManager;
use yii\base\Widget;

//
/**
 * Class GalleryWidget
 * @package backend\widgets\Gallery
 */
class GalleryWidget extends Widget
{


    /**
     * Namespace на common модели
     *
     * @var null
     */

    public $nameSpaceModel = null;


    /**
     * Namespace на thread модели
     *
     * @var null
     */

    public $model = null;


    /**
     * View
     *
     * @var string
     */
    public $view = 'GalleryWidgetView';


    /**
     * Seo model
     *
     * @var null
     */
    private $_seoModel = null;


    /**
     * Model lang
     *
     * @var null
     */
    private $_seoModelLang = null;


    /** @var bool Отображать список шаблонов */
    public $viewTemplate = false;


    public $form = null;


    /**
     * Run run run
     *
     * @return string
     */
    public function init()
    {
//        if ($this->model instanceof SeoInterface) {
//            $modelNamespace = get_class($this->model)::getModelNamespace();
//
//            $this->_seoModel = Seo::getModelByNamespace($modelNamespace, (isset($this->model->id)) ? $this->model->id : null);
//            $this->_seoModelLang = (isset($this->_seoModel->lang)) ? $this->_seoModel->lang : new SeoLang();
//        }
    }


    /**
     * Run run run
     *
     * @return string
     */
    public function run()
    {
            return $this->render($this->view, [
                'model' => $this->model,
                'form' => $this->form,
                'galleryManager' => new GalleryManager()
            ]);
    }
}