for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Hosting Plugin for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-hosting
* @package hipanel-module-hosting
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
*/
namespace hipanel\modules\hosting\widgets\combo;
use hiqdev\combo\Combo;
use yii\helpers\ArrayHelper;
use yii\web\JsExpression;
* Class HdomainCombo.
class HdomainCombo extends Combo
{
/** {@inheritdoc} */
public $type = 'hosting/hdomain';
public $name = 'login';
public $url = '/hosting/hdomain/index';
public $_return = ['id', 'server'];
public $_rename = ['text' => 'domain'];
* @var array used in [[getPluginOptions()]]
public $activeWhen = ['hosting/vhost'];
public function getFilter()
return ArrayHelper::merge(parent::getFilter(), [
'server' => 'server/server',
'account' => 'hosting/account',
]);
}
public function getPluginOptions($options = [])
return parent::getPluginOptions(ArrayHelper::merge([
'activeWhen' => $this->activeWhen,
'select2Options' => [
'templateResult' => new JsExpression("function (data) {
if (data.loading) {
return data.text;
return data.text + ' - ' + data.server;
}"),
],
], $options));