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
29973c57
Commit
29973c57
authored
May 03, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added anchors to guide. [skip ci]
parent
80564a9a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
0 deletions
+33
-0
concept-aliases.md
docs/guide/concept-aliases.md
+5
-0
concept-behaviors.md
docs/guide/concept-behaviors.md
+11
-0
concept-configurations.md
docs/guide/concept-configurations.md
+7
-0
concept-events.md
docs/guide/concept-events.md
+10
-0
No files found.
docs/guide/concept-aliases.md
View file @
29973c57
...
...
@@ -7,6 +7,7 @@ For example, the alias `@yii` represents the installation path of the Yii framew
the base URL for the currently running Web application.
<a
name=
"defining-aliases"
></a>
Defining Aliases
----------------
...
...
@@ -49,6 +50,7 @@ return [
```
<a
name=
"resolving-aliases"
></a>
Resolving Aliases
-----------------
...
...
@@ -81,6 +83,7 @@ Yii::getAlias('@foo/bar/file.php'); // displays: /path2/bar/file.php
If
`@foo/bar`
is not defined as a root alias, the last statement would display
`/path/to/foo/bar/file.php`
.
<a
name=
"using-aliases"
></a>
Using Aliases
-------------
...
...
@@ -100,6 +103,7 @@ $cache = new FileCache([
Please pay attention to the API documentation to see if a property or method parameter supports aliases.
<a
name=
"predefined-aliases"
></a>
Predefined Aliases
------------------
...
...
@@ -118,6 +122,7 @@ while the rest of the aliases are defined in the application constructor when ap
[
configuration
](
concept-configurations.md
)
.
<a
name=
"extension-aliases"
></a>
Extension Aliases
-----------------
...
...
docs/guide/concept-behaviors.md
View file @
29973c57
...
...
@@ -10,6 +10,7 @@ can respond to the [events](concept-events.md) triggered by the component so tha
code execution of the component.
<a
name=
"using-behaviors"
></a>
Using Behaviors
---------------
...
...
@@ -54,6 +55,7 @@ $behaviors = $component->getBehaviors();
```
<a
name=
"attaching-behaviors"
></a>
Attaching Behaviors
-------------------
...
...
@@ -126,7 +128,11 @@ $component->attachBehavior('myBehavior3', [
]);
```
You may also attach behaviors through
[
configurations
](
concept-configurations.md
)
. For more details, please
refer to the
[
Configurations
](
concept-configurations.md#configuration-format
)
chapter.
<a
name=
"detaching-behaviors"
></a>
Detaching Behaviors
-------------------
...
...
@@ -143,6 +149,7 @@ $component->detachBehaviors();
```
<a
name=
"defining-behaviors"
></a>
Defining Behaviors
------------------
...
...
@@ -228,6 +235,7 @@ function ($event) {
```
<a
name=
"using-timestamp-behavior"
></a>
Using `TimestampBehavior`
-------------------------
...
...
@@ -286,6 +294,7 @@ $user->touch('login_time');
```
<a
name=
"comparison-with-traits"
></a>
Comparison with Traits
----------------------
...
...
@@ -294,6 +303,7 @@ properties and methods to the primary class, they differ in many aspects. As exp
both have pros and cons. They are more like complements rather than replacements to each other.
<a
name=
"pros-for-behaviors"
></a>
### Pros for Behaviors
Behavior classes, like normal classes, support inheritance. Traits, on the other hand,
...
...
@@ -312,6 +322,7 @@ Name conflict caused by different traits requires you to manually resolve it by
properties or methods.
<a
name=
"pros-for-traits"
></a>
### Pros for Traits
Traits are much more efficient than behaviors because behaviors are objects which take both time and memory.
...
...
docs/guide/concept-configurations.md
View file @
29973c57
...
...
@@ -35,6 +35,7 @@ Yii::configure($object, $config);
Note that in this case, the configuration should not contain the
`class`
element.
<a
name=
"configuration-format"
></a>
Configuration Format
--------------------
...
...
@@ -79,6 +80,7 @@ Below is an example showing a configuration with property initial values, event
```
<a
name=
"using-configurations"
></a>
Using Configurations
--------------------
...
...
@@ -87,6 +89,7 @@ create an object according to a configuration by using [[Yii::createObject()]].
describe application configurations and widget configurations - two major usages of configurations.
<a
name=
"application-configurations"
></a>
### Application Configurations
Configuration for an
[
application
](
structure-applications.md
)
is probably one of the most complex configurations.
...
...
@@ -138,6 +141,7 @@ For more details about configuring the `components` property of an application c
in the
[
Applications
](
structure-applications.md
)
chapter and the
[
Service Locator
](
concept-service-locator.md
)
chapter.
<a
name=
"widget-configurations"
></a>
### Widget Configurations
When using
[
widgets
](
structure-widgets.md
)
, you often need to use configurations to customize the widget properties.
...
...
@@ -163,6 +167,7 @@ The `items` property is also configured with menu items to be displayed.
Note that because the class name is already given, the configuration array should NOT have the
`class`
key.
<a
name=
"configuration-files"
></a>
Configuration Files
-------------------
...
...
@@ -217,6 +222,7 @@ $config = require('path/to/web.php');
```
<a
name=
"default-configurations"
></a>
Default Configurations
----------------------
...
...
@@ -238,6 +244,7 @@ Without using default configurations, you would have to configure `maxButtonCoun
link pagers.
<a
name=
"environment-constants"
></a>
Environment Constants
---------------------
...
...
docs/guide/concept-events.md
View file @
29973c57
...
...
@@ -10,6 +10,7 @@ Yii introduces a base class called [[yii\base\Component]] to support events. If
events, it should extend from
[
[yii\base\Component
]
] or its child class.
<a
name=
"triggering-events"
></a>
Triggering Events
-----------------
...
...
@@ -76,6 +77,7 @@ When the [[yii\base\Component::trigger()]] method is called, it will call handle
the named event.
<a
name=
"event-handlers"
></a>
Event Handlers
--------------
...
...
@@ -102,6 +104,7 @@ Through the `$event` parameter, an event handler may get the following informati
-
[
[yii\base\Event::data|custom data
]
]: the data that is provided when attaching the event handler (to be explained shortly).
<a
name=
"attaching-event-handlers"
></a>
Attaching Event Handlers
------------------------
...
...
@@ -125,6 +128,10 @@ $foo->on(Foo::EVENT_HELLO, function ($event) {
});
```
You may also attach event handlers through
[
configurations
](
concept-configurations.md
)
. For more details, please
refer to the
[
Configurations
](
concept-configurations.md#configuration-format
)
chapter.
When attaching an event handler, you may provide additional data as the third parameter to
[
[yii\base\Component::on()
]
].
The data will be made available to the handler when the event is triggered and the handler is called. For example,
...
...
@@ -159,6 +166,7 @@ $foo->on(Foo::EVENT_HELLO, function ($event) {
```
<a
name=
"detaching-event-handlers"
></a>
Detaching Event Handlers
------------------------
...
...
@@ -189,6 +197,7 @@ $foo->off(Foo::EVENT_HELLO);
```
<a
name=
"class-level-event-handlers"
></a>
Class-Level Event Handlers
--------------------------
...
...
@@ -247,6 +256,7 @@ Event::off(Foo::className(), Foo::EVENT_HELLO);
```
<a
name=
"global-events"
></a>
Global Events
-------------
...
...
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