本文整理汇总了PHP中Yii::setAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::setAlias方法的具体用法?PHP Yii::setAlias怎么用?PHP Yii::setAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::setAlias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
\Yii::setAlias('@webuploader', __DIR__);
if (empty($this->driver)) {
$this->driver = isset(\Yii::$app->params['webuploader_driver']) ? \Yii::$app->params['webuploader_driver'] : 'local';
}
if ($this->driver == 'local') {
// 初始化@static别名,默认@web/static,最好根据自己的需求提前设置好@static别名
$static = \Yii::getAlias('@static', false);
$staticroot = \Yii::getAlias('@staticroot', false);
if (!$static || !$staticroot) {
\Yii::setAlias('@static', '@web/static');
\Yii::setAlias('@staticroot', '@webroot/static');
}
}
$this->server = $this->server ?: Url::to(['/site/webupload', 'driver' => $this->driver]);
$this->options['boxId'] = isset($this->options['boxId']) ? $this->options['boxId'] : 'picker';
$this->options['previewWidth'] = isset($this->options['previewWidth']) ? $this->options['previewWidth'] : '250';
$this->options['previewHeight'] = isset($this->options['previewHeight']) ? $this->options['previewHeight'] : '150';
if ($this->hasModel()) {
$this->hiddenInput = Html::activeHiddenInput($this->model, $this->attribute);
} else {
$this->hiddenInput = Html::hiddenInput($this->name, $this->value);
}
}
示例2: init
public function init()
{
parent::init();
\Yii::setAlias('@foundationTopbar', dirname(__FILE__));
$this->registerAsset();
if (!is_null($this->contain)) {
echo Html::beginTag('div', $this->contain);
}
Html::addCssClass($this->title['nameOptions'], 'top-bar');
Html::addCssClass($this->title['listNameOptions'], 'name');
Html::addCssClass($this->options['sectionOptions'], 'top-bar-section');
Html::addCssClass($this->options['navOptions'], 'top-bar');
if (!isset($this->options['navOptions']['data-topbar'])) {
$this->options['navOptions']['data-topbar'] = '';
}
echo Html::beginTag('nav', $this->options['navOptions']);
echo Html::beginTag('ul', ['class' => 'title-area']);
if (!empty($this->title['name'])) {
echo Html::beginTag('li', $this->title['listNameOptions']);
echo Html::beginTag('h1');
echo Html::a($this->title['name'], $this->title['nameUrl'], $this->title['nameOptions']);
echo Html::endTag('h1');
echo Html::endTag('li');
}
echo Html::tag('li', '<a href="#"><span>Menu</span></a>', ['class' => "toggle-topbar menu-icon"]);
echo Html::endTag('ul');
echo Html::beginTag('section', $this->options['sectionOptions']);
}
示例3: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
parent::setUp();
$this->mockWebApplication();
\Yii::setAlias('@webroot', __DIR__ . '/runtime/web');
\Yii::setAlias('@web', '/runtime/web');
}
示例4: init
public function init()
{
parent::init();
Yii::setAlias('@webroot', '@frontend/web');
Yii::setAlias('@web', '/');
Yii::$app->set('assetManager', $this->assetManager);
}
示例5: bootstrap
public function bootstrap($app)
{
\Yii::setAlias("@appBuilder", __DIR__ . '/..');
if ($app instanceof \yii\console\Application) {
$app->controllerMap[$this->id] = ['class' => 'AppBuilder\\Controllers\\AppBuilderController', 'module' => $this];
}
}
示例6: bootstrap
public function bootstrap($app)
{
/**
*
* @var Module $systemModule
* @var \app\modules\user\Module $userModule
*
*/
if ($app->hasModule('system') && ($systemModule = $app->getModule('system')) instanceof Module) {
// Установка теми з настроек сайту
$themeFrontend = Yii::$app->keyStorage->get('themeFrontend');
\Yii::$app->set('view', ['class' => 'app\\components\\FrontendView', 'title' => 'Frontend Template', 'enableMinify' => false, 'web_path' => '@web', 'base_path' => '@webroot', 'minify_path' => '@webroot/assets', 'js_position' => [\yii\web\View::POS_HEAD], 'force_charset' => 'UTF-8', 'expand_imports' => !YII_ENV_DEV, 'compress_output' => !YII_ENV_DEV, 'compress_options' => ['extra' => !YII_ENV_DEV], 'concatCss' => !YII_ENV_DEV, 'minifyCss' => !YII_ENV_DEV, 'concatJs' => !YII_ENV_DEV, 'minifyJs' => !YII_ENV_DEV, 'theme' => ['basePath' => '@app/templates/frontend/' . $themeFrontend, 'baseUrl' => '@web/templates/frontend/' . $themeFrontend . '/web', 'pathMap' => ['@app/views' => '@app/templates/frontend/' . $themeFrontend . '/views', '@app/modules' => '@app/templates/frontend/' . $themeFrontend . '/modules', '@app/widgets' => '@app/templates/frontend/' . $themeFrontend . '/widgets']], 'as seo' => ['class' => 'app\\modules\\system\\components\\SeoViewBehavior']]);
$assetManager = ['class' => 'yii\\web\\AssetManager', 'linkAssets' => false, 'appendTimestamp' => YII_ENV_DEV, 'converter' => ['class' => 'nizsheanez\\assetConverter\\Converter', 'destinationDir' => 'css/../', 'parsers' => ['sass' => ['class' => 'nizsheanez\\assetConverter\\Sass', 'output' => 'css', 'options' => ['cachePath' => '@app/runtime/cache/sass-parser']], 'scss' => ['class' => 'nizsheanez\\assetConverter\\Scss', 'output' => 'css', 'options' => []], 'less' => ['class' => 'nizsheanez\\assetConverter\\Less', 'output' => 'css', 'options' => ['auto' => true]]]]];
$assetManager['bundles'] = ['yii\\jui\\JuiAsset' => ['sourcePath' => '@app/media/', 'js' => ['js/jquery-ui.min.js'], 'css' => []]];
if (strpos(Yii::$app->request->pathInfo, 'admin') !== 0) {
$assetManager['bundles'] = ['yii\\bootstrap\\BootstrapAsset' => []];
}
\Yii::$app->set('assetManager', $assetManager);
\Yii::setAlias('@frontendTemplate', realpath(__DIR__ . '/../../templates/frontend/' . $themeFrontend));
// Індексація сайту
if (!Yii::$app->keyStorage->get('indexing')) {
\Yii::$app->getView()->registerMetaTag(['name' => 'robots', 'content' => 'noindex, nofollow']);
}
}
}
示例7: init
/**
* Initializes the widget
* @throw InvalidConfigException
*/
public function init()
{
parent::init();
\Yii::setAlias('@xeditable', dirname(__FILE__));
$this->registerAssets();
//test
}
示例8: init
/**
* Initializes the widget
* @throw InvalidConfigException
*/
public function init()
{
parent::init();
//base url
$asset = new DropZoneAsset();
DropZoneAsset::register($this->view);
\Yii::setAlias('@cmsAB-Dropzone', dirname(__FILE__));
$this->_ruta = \Yii::getAlias('@cmsAB-Dropzone');
//set defaults
$loading = '/vendor/cmsAB/yii2-dropzone/assets/img/cargando.gif';
$this->_imagenes = !empty($this->initImagenes) ? $this->initImagenes : '';
$this->_iconLoading = !empty($this->iconLoading) ? $loading : $this->iconLoading;
if (!isset($this->options['url'])) {
$this->options['url'] = $this->uploadUrl;
}
// Set the url
if (!isset($this->options['previewsContainer'])) {
$this->options['previewsContainer'] = '#' . $this->previewsContainer;
}
// Define the element that should be used as click trigger to select files.
if (!isset($this->options['clickable'])) {
$this->options['clickable'] = true;
}
// Define the element that should be used as click trigger to select files.
$this->autoDiscover = $this->autoDiscover === false ? 'false' : 'true';
if (\Yii::$app->getRequest()->enableCsrfValidation) {
$this->options['headers'][\yii\web\Request::CSRF_HEADER] = \Yii::$app->getRequest()->getCsrfToken();
$this->options['params'][\Yii::$app->getRequest()->csrfParam] = \Yii::$app->getRequest()->getCsrfToken();
}
$this->registerAssets();
}
示例9: bootstrap
/**
* Bootstrap method to be called during application bootstrap stage.
*
* @param Application $app the application currently running
*/
public function bootstrap($app)
{
/**
* @var Module $gii
*/
\Yii::setAlias('@carono', '@vendor/carono/yii2-components');
if ($app instanceof \yii\console\Application) {
$commands = ['city' => 'CityController', 'currency' => 'CurrencyController', 'dumper' => 'DumperController', 'carono' => 'CaronoController'];
foreach ($commands as $name => $command) {
$name = file_exists(\Yii::getAlias("@app/commands/{$command}.php")) ? "carono" . ucfirst($name) : $name;
$app->controllerMap[$name] = 'carono\\components\\commands\\' . $command;
}
if (!isset($app->controllerMap['giix'])) {
if (($gii = $app->getModule('gii')) && isset($gii->generators["giiant-model"])) {
if (!isset($gii->generators["giiant-model"]["templates"])) {
if (is_array($gii->generators["giiant-model"])) {
$gii->generators["giiant-model"]["templates"] = [];
} else {
$gii->generators["giiant-model"] = ["class" => 'schmunk42\\giiant\\generators\\model\\Generator', "templates" => []];
}
}
$template = '@vendor/carono/yii2-components/templates/giiant-model';
$gii->generators["giiant-model"]["templates"]["caronoModel"] = $template;
$app->controllerMap['giix'] = 'carono\\components\\commands\\GiixController';
}
}
}
}
示例10: bootstrap
/**
* Bootstrap method to be called during application bootstrap stage.
*
* @param Application $app the application currently running
*/
public function bootstrap($app)
{
\Yii::setAlias('@cornernote/dashboard', __DIR__);
if ($app->has('i18n')) {
$app->i18n->translations['dashboard'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@cornernote/dashboard/messages'];
}
}
示例11: bootstrap
/**
* @inheritDoc
*/
public function bootstrap($app)
{
\Yii::setAlias('@choate/coderelease', __DIR__);
if ($app instanceof \yii\console\Application) {
$app->controllerMap[$this->id] = ['class' => '\\choate\\coderelease\\console\\CodeReleaseController'];
}
}
示例12: init
public function init()
{
\Yii::setAlias('@summernote', dirname(__FILE__));
if (!isset($this->htmlOptions['id'])) {
$this->htmlOptions['id'] = $this->getId();
}
parent::init();
}
示例13: init
public function init()
{
Yii::setAlias('@daterangepicker', __DIR__);
foreach (static::$extra_js as $js_file) {
$this->js[] = $js_file;
}
return parent::init();
}
示例14: init
public function init()
{
parent::init();
\Yii::$app->response->formatters = ArrayHelper::merge(\Yii::$app->response->formatters, $this->responseFormatter);
\Yii::setAlias('@jsonrpc', __DIR__);
$view = \Yii::$app->getView();
JsonrpcAsset::register($view);
}
示例15: init
public function init()
{
\Yii::setAlias('@dropzone', dirname(__FILE__));
if (!isset($this->url)) {
$this->url = \Yii::$app->urlManager->createUrl('site/upload');
}
parent::init();
}