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
64b61abc
Commit
64b61abc
authored
Feb 27, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added paths and extensions options to view class.
Signed-off-by:
Taylor Otwell
<
taylorotwell@gmail.com
>
parent
ca5dfa40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
view.php
laravel/view.php
+27
-8
No files found.
laravel/view.php
View file @
64b61abc
...
@@ -37,6 +37,20 @@ class View implements ArrayAccess {
...
@@ -37,6 +37,20 @@ class View implements ArrayAccess {
*/
*/
public
static
$names
=
array
();
public
static
$names
=
array
();
/**
* The extensions a view file can have.
*
* @var array
*/
public
static
$extensions
=
array
(
EXT
);
/**
* The path in which a view can live.
*
* @var array
*/
public
static
$paths
=
array
(
DEFAULT_BUNDLE
=>
array
(
''
));
/**
/**
* The Laravel view engine event name.
* The Laravel view engine event name.
*
*
...
@@ -99,11 +113,16 @@ class View implements ArrayAccess {
...
@@ -99,11 +113,16 @@ class View implements ArrayAccess {
// We need to make sure that the view exists. If it doesn't, we will
// We need to make sure that the view exists. If it doesn't, we will
// throw an exception since there is not any point in going further.
// throw an exception since there is not any point in going further.
// If it does, we can just return the full view path.
// If it does, we can just return the full view path.
$path
=
$root
.
Bundle
::
element
(
$view
)
.
EXT
;
$path
s
=
array_get
(
static
::
$paths
,
Bundle
::
name
(
$view
),
array
(
''
))
;
if
(
file_exists
(
$path
)
)
foreach
(
$paths
as
$path
)
{
{
return
$path
;
foreach
(
static
::
$extensions
as
$ext
)
{
$file
=
$root
.
$path
.
Bundle
::
element
(
$view
)
.
$ext
;
if
(
file_exists
(
$file
))
return
$file
;
}
}
}
throw
new
\Exception
(
"View [
$view
] doesn't exist."
);
throw
new
\Exception
(
"View [
$view
] doesn't exist."
);
...
@@ -211,12 +230,12 @@ class View implements ArrayAccess {
...
@@ -211,12 +230,12 @@ class View implements ArrayAccess {
// allows easy attachment of other view parsers.
// allows easy attachment of other view parsers.
if
(
Event
::
listeners
(
static
::
engine
))
if
(
Event
::
listeners
(
static
::
engine
))
{
{
return
Event
::
first
(
static
::
engine
,
array
(
$this
));
$result
=
Event
::
first
(
static
::
engine
,
array
(
$this
));
}
else
if
(
$result
!==
false
)
return
$result
;
{
return
$this
->
get
();
}
}
return
$this
->
get
();
}
}
/**
/**
...
...
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