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
104c4fc3
Commit
104c4fc3
authored
Apr 04, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support to allow an event handler to be inserted at the beginning of the…
Added support to allow an event handler to be inserted at the beginning of the existing event handler list
parent
9c0f236a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
38 deletions
+10
-38
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Component.php
framework/base/Component.php
+9
-3
ContentTypeNegotiator.php
framework/web/ContentTypeNegotiator.php
+0
-35
No files found.
framework/CHANGELOG.md
View file @
104c4fc3
...
@@ -186,6 +186,7 @@ Yii Framework 2 Change Log
...
@@ -186,6 +186,7 @@ Yii Framework 2 Change Log
-
Enh: Added
`yii\web\Request::getAuthUser()`
and
`getAuthPassword()`
(qiangxue)
-
Enh: Added
`yii\web\Request::getAuthUser()`
and
`getAuthPassword()`
(qiangxue)
-
Enh: Added summaryOptions and emptyTextOptions to BaseListView (johonunu)
-
Enh: Added summaryOptions and emptyTextOptions to BaseListView (johonunu)
-
Enh: Implemented Oracle column comment reading from another schema (gureedo, samdark)
-
Enh: Implemented Oracle column comment reading from another schema (gureedo, samdark)
-
Enh: Added support to allow an event handler to be inserted at the beginning of the existing event handler list (qiangxue)
-
Chg #47: Changed Markdown library to cebe/markdown and adjusted Markdown helper API (cebe)
-
Chg #47: Changed Markdown library to cebe/markdown and adjusted Markdown helper API (cebe)
-
Chg #735: Added back
`ActiveField::hiddenInput()`
(qiangxue)
-
Chg #735: Added back
`ActiveField::hiddenInput()`
(qiangxue)
-
Chg #1186: Changed
`Sort`
to use comma to separate multiple sort fields and use negative sign to indicate descending sort (qiangxue)
-
Chg #1186: Changed
`Sort`
to use comma to separate multiple sort fields and use negative sign to indicate descending sort (qiangxue)
...
...
framework/base/Component.php
View file @
104c4fc3
...
@@ -473,12 +473,19 @@ class Component extends Object
...
@@ -473,12 +473,19 @@ class Component extends Object
* @param callable $handler the event handler
* @param callable $handler the event handler
* @param mixed $data the data to be passed to the event handler when the event is triggered.
* @param mixed $data the data to be passed to the event handler when the event is triggered.
* When the event handler is invoked, this data can be accessed via [[Event::data]].
* When the event handler is invoked, this data can be accessed via [[Event::data]].
* @param boolean $append whether to append new event handler to the end of the existing
* handler list. If false, the new handler will be inserted at the beginning of the existing
* handler list.
* @see off()
* @see off()
*/
*/
public
function
on
(
$name
,
$handler
,
$data
=
null
)
public
function
on
(
$name
,
$handler
,
$data
=
null
,
$append
=
true
)
{
{
$this
->
ensureBehaviors
();
$this
->
ensureBehaviors
();
$this
->
_events
[
$name
][]
=
[
$handler
,
$data
];
if
(
$append
||
empty
(
$this
->
_events
[
$name
]))
{
$this
->
_events
[
$name
][]
=
[
$handler
,
$data
];
}
else
{
array_unshift
(
$this
->
_events
[
$name
],
[
$handler
,
$data
]);
}
}
}
/**
/**
...
@@ -498,7 +505,6 @@ class Component extends Object
...
@@ -498,7 +505,6 @@ class Component extends Object
}
}
if
(
$handler
===
null
)
{
if
(
$handler
===
null
)
{
unset
(
$this
->
_events
[
$name
]);
unset
(
$this
->
_events
[
$name
]);
return
true
;
return
true
;
}
else
{
}
else
{
$removed
=
false
;
$removed
=
false
;
...
...
framework/web/ContentTypeNegotiator.php
deleted
100644 → 0
View file @
9c0f236a
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\web
;
use
yii\base\Component
;
/**
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
ContentTypeNegotiator
extends
Component
{
/**
* @var array list of supported API version numbers. If the current request does not specify a version
* number, the first element will be used as the [[version|chosen version number]]. For this reason, you should
* put the latest version number at the first. If this property is empty, [[version]] will not be set.
*/
public
$supportedVersions
=
[];
/**
* @var array list of supported response formats. The array keys are the requested content MIME types,
* and the array values are the corresponding response formats. The first element will be used
* as the response format if the current request does not specify a content type.
*/
public
$supportedFormats
=
[
'application/json'
=>
Response
::
FORMAT_JSON
,
'application/xml'
=>
Response
::
FORMAT_XML
,
];
}
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