Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
d1d4ac10
Commit
d1d4ac10
authored
Aug 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the view class method order and comments.
parent
6590b54f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
view.php
system/view.php
+20
-19
No files found.
system/view.php
View file @
d1d4ac10
...
@@ -136,7 +136,7 @@ class View {
...
@@ -136,7 +136,7 @@ class View {
{
{
$composer
=
static
::
$composers
[
$this
->
module
][
$this
->
view
];
$composer
=
static
::
$composers
[
$this
->
module
][
$this
->
view
];
if
(
!
is_null
(
$composer
=
$this
->
find_composer_
handler
(
$composer
)))
if
(
!
is_null
(
$composer
=
$this
->
find_composer_
function
(
$composer
)))
{
{
call_user_func
(
$composer
,
$this
);
call_user_func
(
$composer
,
$this
);
}
}
...
@@ -144,15 +144,31 @@ class View {
...
@@ -144,15 +144,31 @@ class View {
}
}
/**
/**
* Find the composer handler / function in a composer definition.
* Load the view composers for a given module.
*
* @param string $module
* @return void
*/
private
static
function
load_composers
(
$module
)
{
if
(
isset
(
static
::
$composers
[
$module
]))
return
;
$composers
=
(
$module
==
'application'
)
?
APP_PATH
.
'composers'
.
EXT
:
MODULE_PATH
.
$module
.
'/composers'
.
EXT
;
static
::
$composers
[
$module
]
=
(
file_exists
(
$composers
))
?
require
$composers
:
array
();
}
/**
* Find the composer function in a composer definition.
*
*
* If the composer value itself is callable, it will be returned, otherwise the
* If the composer value itself is callable, it will be returned, otherwise the
* first callable value in the composer array will be returned.
* first callable value in the composer array will be returned. If the composer
* value is a string, it is simply a view name being defined.
*
*
* @param mixed $composer
* @param mixed $composer
* @return Closure
* @return Closure
*/
*/
private
function
find_composer_
handler
(
$composer
)
private
function
find_composer_
function
(
$composer
)
{
{
if
(
is_string
(
$composer
))
return
;
if
(
is_string
(
$composer
))
return
;
...
@@ -164,21 +180,6 @@ class View {
...
@@ -164,21 +180,6 @@ class View {
}
}
}
}
/**
* Load the view composers for a given module.
*
* @param string $module
* @return void
*/
private
static
function
load_composers
(
$module
)
{
if
(
isset
(
static
::
$composers
[
$module
]))
return
;
$composers
=
(
$module
==
'application'
)
?
APP_PATH
.
'composers'
.
EXT
:
MODULE_PATH
.
$module
.
'/composers'
.
EXT
;
static
::
$composers
[
$module
]
=
(
file_exists
(
$composers
))
?
require
$composers
:
array
();
}
/**
/**
* Get the parsed content of the view.
* Get the parsed content of the view.
*
*
...
...
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