Skip to content

Commit

Permalink
HdomainCombo - added activeWhen option
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Nov 12, 2015
1 parent 12cb7d2 commit b3b6fd3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/widgets/combo/HdomainCombo.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
use yii\web\JsExpression;

/**
* Class Account
* Class HdomainCombo
* @package hipanel\modules\hosting\widgets\combo
*/
class HdomainCombo extends Combo
{
Expand All @@ -26,6 +27,11 @@ class HdomainCombo extends Combo
/** @inheritdoc */
public $_rename = ['text' => 'domain'];

/**
* @var array used in [[getPluginOptions()]]
*/
public $activeWhen = ['hosting/vhost'];

/** @inheritdoc */
public function getFilter()
{
Expand All @@ -38,13 +44,13 @@ public function getFilter()
/** @inheritdoc */
public function getPluginOptions($options = [])
{
return parent::getPluginOptions([
'activeWhen' => ['hosting/vhost'],
return parent::getPluginOptions(ArrayHelper::merge([
'activeWhen' => $this->activeWhen,
'select2Options' => [
'formatResult' => new JsExpression("function (data) {
return data.text + ' - ' + data.server;
}")
]
]);
], $options));
}
}

0 comments on commit b3b6fd3

Please sign in to comment.