for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace hipanel\widgets;
use hipanel\assets\ApplyToAllAsset;
use yii\base\Widget;
/**
* Class AssignAttributesWidget
* @package hipanel\widgets
*/
class ApplyToAllWidget extends Widget
{
* @var \hipanel\base\Model[]
public $models;
* @var string[]
public $attributes;
* @inheritDoc
public function run()
ApplyToAllAsset::register($this->view);
$options = \yii\helpers\Json::htmlEncode([
'countModels' => count($this->models),
'formName' => strtolower(reset($this->models)->formName()),
'attributes' => $this->attributes,
'linkText' => \Yii::t('hipanel', 'Apply to all'),
]);
$this->view->registerJs("\$('#assign-hubs-form').applyToAll($options);");
return parent::run();
}