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
50a56ad2
Commit
50a56ad2
authored
Nov 19, 2014
by
Christopher Vrooman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update structure-modules.md
Minor syntax changes.
parent
704aa566
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
structure-modules.md
docs/guide/structure-modules.md
+5
-5
No files found.
docs/guide/structure-modules.md
View file @
50a56ad2
...
...
@@ -100,7 +100,7 @@ class PostController extends Controller
```
You may customize the namespace of controller classes by configuring the
[
[yii\base\Module::controllerNamespace
]
]
property. In case
when some of the controllers are out
of this namespace, you may make them accessible
property. In case
some of the controllers are outside
of this namespace, you may make them accessible
by configuring the
[
[yii\base\Module::controllerMap
]
] property, similar to
[
what you do in an application
](
structure-applications.md#controller-map
)
.
...
...
@@ -162,7 +162,7 @@ $module = MyModuleClass::getInstance();
where
`MyModuleClass`
refers to the name of the module class that you are interested in. The
`getInstance()`
method
will return the currently requested instance of the module class. If the module is not requested, the method will
return null. Note that
Y
ou do not want to manually create a new instance of the module class because it will be
return null. Note that
y
ou do not want to manually create a new instance of the module class because it will be
different from the one created by Yii in response to a request.
> Info: When developing a module, you should not assume the module will use a fixed ID. This is because a module
...
...
@@ -183,7 +183,7 @@ $module = \Yii::$app->controller->module;
The first approach is only useful when you know the module ID, while the second approach is best used when you
know about the controllers being requested.
Once
getting hold of a module instance, you can access parameters or
components registered with the module. For example,
Once
you have the module instance, you can access parameters and
components registered with the module. For example,
```
php
$maxPostCount
=
$module
->
params
[
'maxPostCount'
];
...
...
@@ -195,7 +195,7 @@ $maxPostCount = $module->params['maxPostCount'];
Some modules may need to be run for every request. The
[
[yii\debug\Module|debug
]
] module is such an example.
To do so, list the IDs of such modules in the
[
[yii\base\Application::bootstrap|bootstrap
]
] property of the application.
For example, the following application configuration makes sure the
`debug`
module is always load:
For example, the following application configuration makes sure the
`debug`
module is always load
ed
:
```
php
[
...
...
@@ -235,7 +235,7 @@ class Module extends \yii\base\Module
}
```
For a controller within a nested module, its route should include the IDs of all its ancestor module.
For a controller within a nested module, its route should include the IDs of all its ancestor module
s
.
For example, the route
`forum/admin/dashboard/index`
represents the
`index`
action of the
`dashboard`
controller
in the
`admin`
module which is a child module of the
`forum`
module.
...
...
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