Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
79b278c8
Commit
79b278c8
authored
Apr 09, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored theme.
parent
fc415b15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
22 deletions
+13
-22
Theme.php
framework/base/Theme.php
+13
-22
No files found.
framework/base/Theme.php
View file @
79b278c8
...
@@ -33,11 +33,17 @@ use yii\helpers\FileHelper;
...
@@ -33,11 +33,17 @@ use yii\helpers\FileHelper;
class
Theme
extends
Component
class
Theme
extends
Component
{
{
/**
/**
* @var string the root path of this theme.
* @var string the root path or path alias of this theme. All resources of this theme are located
* under this directory. This property must be set if [[pathMap]] is not set.
* @see pathMap
* @see pathMap
*/
*/
public
$basePath
;
public
$basePath
;
/**
/**
* @var string the base URL (or path alias) for this theme. All resources of this theme are considered
* to be under this base URL. This property must be set. It is mainly used by [[getUrl()]].
*/
public
$baseUrl
;
/**
* @var array the mapping between view directories and their corresponding themed versions.
* @var array the mapping between view directories and their corresponding themed versions.
* If not set, it will be initialized as a mapping from [[Application::basePath]] to [[basePath]].
* If not set, it will be initialized as a mapping from [[Application::basePath]] to [[basePath]].
* This property is used by [[applyTo()]] when a view is trying to apply the theme.
* This property is used by [[applyTo()]] when a view is trying to apply the theme.
...
@@ -45,7 +51,6 @@ class Theme extends Component
...
@@ -45,7 +51,6 @@ class Theme extends Component
*/
*/
public
$pathMap
;
public
$pathMap
;
private
$_baseUrl
;
/**
/**
* Initializes the theme.
* Initializes the theme.
...
@@ -69,25 +74,11 @@ class Theme extends Component
...
@@ -69,25 +74,11 @@ class Theme extends Component
$paths
[
$from
.
DIRECTORY_SEPARATOR
]
=
$to
.
DIRECTORY_SEPARATOR
;
$paths
[
$from
.
DIRECTORY_SEPARATOR
]
=
$to
.
DIRECTORY_SEPARATOR
;
}
}
$this
->
pathMap
=
$paths
;
$this
->
pathMap
=
$paths
;
}
if
(
$this
->
baseUrl
===
null
)
{
throw
new
InvalidConfigException
(
"Theme::baseUrl must be set."
);
/**
}
else
{
* Returns the base URL for this theme.
$this
->
baseUrl
=
rtrim
(
Yii
::
getAlias
(
$this
->
baseUrl
),
'/'
);
* The method [[getUrl()]] will prefix this to the given URL.
}
* @return string the base URL for this theme.
*/
public
function
getBaseUrl
()
{
return
$this
->
_baseUrl
;
}
/**
* Sets the base URL for this theme.
* @param string $value the base URL for this theme.
*/
public
function
setBaseUrl
(
$value
)
{
$this
->
_baseUrl
=
rtrim
(
Yii
::
getAlias
(
$value
),
'/'
);
}
}
/**
/**
...
@@ -112,7 +103,7 @@ class Theme extends Component
...
@@ -112,7 +103,7 @@ class Theme extends Component
}
}
/**
/**
* Converts a relative URL into an absolute URL using [[base
Path
]].
* Converts a relative URL into an absolute URL using [[base
Url
]].
* @param string $url the relative URL to be converted.
* @param string $url the relative URL to be converted.
* @return string the absolute URL
* @return string the absolute URL
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment