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
32818ab1
Commit
32818ab1
authored
Dec 26, 2012
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added getter and setter for application title to web Controller
parent
5dbf1e49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
Controller.php
framework/web/Controller.php
+28
-0
No files found.
framework/web/Controller.php
View file @
32818ab1
...
...
@@ -22,6 +22,8 @@ use yii\base\HttpException;
*/
class
Controller
extends
\yii\base\Controller
{
private
$_pageTitle
;
/**
* Returns the request parameters that will be used for action parameter binding.
* Default implementation simply returns an empty array.
...
...
@@ -45,4 +47,29 @@ class Controller extends \yii\base\Controller
{
throw
new
HttpException
(
400
,
\Yii
::
t
(
'yii'
,
'Your request is invalid.'
));
}
/**
* @return string the page title. Defaults to the controller name and the action name.
*/
public
function
getPageTitle
()
{
if
(
$this
->
_pageTitle
!==
null
)
{
return
$this
->
_pageTitle
;
}
else
{
$name
=
ucfirst
(
basename
(
$this
->
id
));
if
(
$this
->
action
!==
null
&&
strcasecmp
(
$this
->
action
->
id
,
$this
->
defaultAction
))
return
$this
->
_pageTitle
=
\Yii
::
$application
->
name
.
' - '
.
ucfirst
(
$this
->
action
->
id
)
.
' '
.
$name
;
else
return
$this
->
_pageTitle
=
\Yii
::
$application
->
name
.
' - '
.
$name
;
}
}
/**
* @param string $value the page title.
*/
public
function
setPageTitle
(
$value
)
{
$this
->
_pageTitle
=
$value
;
}
}
\ No newline at end of file
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