for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace backend\widgets\chart\morris;
use backend\widgets\chart\morris\assets\MorrisAsset;
use yii\base\Widget;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/**
* Class Base
*
* @package backend\widgets\chart\morris
*/
abstract class Base extends Widget
{
/** @var bool */
public $status = true;
/** @var array */
public $containerOptions = [];
public $clientOptions = [];
* @inheritDoc
public function init()
parent::init();
if ($this->status === true) {
$this->registerAsset();
}
$this->id = $this->id ?: $this->getId();
$containerOptions = [
'id' => $this->id,
'style' => 'position:relative; height:300px; width:auto;'
];
$this->containerOptions = ArrayHelper::merge($containerOptions, $this->containerOptions);
* Run
* @return string
public function run()
return Html::tag('div', '', $this->containerOptions);
* Client Options
* @return array
public function getClientOptions()
return [
'element' => $this->id,
'resize' => true,
'hideHover' => 'auto',
'data' => [],
* Register Asset
public function registerAsset()
$view = $this->getView();
MorrisAsset::register($view);