Commit 8e8b0b8c authored by Taylor Otwell's avatar Taylor Otwell

More Blade improvements… adds template inheritance.

Signed-off-by: 's avatarTaylor Otwell <taylorotwell@gmail.com>
parent b07ee31f
...@@ -27,4 +27,7 @@ Changes for 3.1: ...@@ -27,4 +27,7 @@ Changes for 3.1:
- Added Route::forward method. - Added Route::forward method.
- Prepend table name to default index names in schema. - Prepend table name to default index names in schema.
- Added for/else to Blade. - Added for/else to Blade.
- Added View::render_each - Added View::render_each
\ No newline at end of file - Able to specify full path to view (path: ).
- Blade extended views.
- Yield is now done via blade through {{ yield("content") }}
\ No newline at end of file
This diff is collapsed.
...@@ -450,4 +450,15 @@ function render($view, $data = array()) ...@@ -450,4 +450,15 @@ function render($view, $data = array())
function render_each($partial, array $data, $iterator, $empty = 'raw|') function render_each($partial, array $data, $iterator, $empty = 'raw|')
{ {
return Laravel\View::render_each($partial, $data, $iterator, $empty); return Laravel\View::render_each($partial, $data, $iterator, $empty);
}
/**
* Get the string contents of a section.
*
* @param string $section
* @return string
*/
function yield($section)
{
return Laravel\Section::yield($section);
} }
\ No newline at end of file
...@@ -73,7 +73,18 @@ class View implements ArrayAccess { ...@@ -73,7 +73,18 @@ class View implements ArrayAccess {
{ {
$this->view = $view; $this->view = $view;
$this->data = $data; $this->data = $data;
$this->path = $this->path($view);
// In order to allow developers to load views outside of the normal loading
// conventions, we'll allow for a raw path to be given in place of the
// typical view name, giving total freedom on view loading.
if (starts_with($view, 'path: '))
{
$this->path = substr($view, 6);
}
else
{
$this->path = $this->path($view);
}
// If a session driver has been specified, we will bind an instance of the // If a session driver has been specified, we will bind an instance of the
// validation error message container to every view. If an error instance // validation error message container to every view. If an error instance
...@@ -327,7 +338,7 @@ class View implements ArrayAccess { ...@@ -327,7 +338,7 @@ class View implements ArrayAccess {
/** /**
* Get the array of view data for the view instance. * Get the array of view data for the view instance.
* *
* The shared view data will be combined with the view data for the instance. * The shared view data will be combined with the view data.
* *
* @return array * @return array
*/ */
...@@ -381,7 +392,15 @@ class View implements ArrayAccess { ...@@ -381,7 +392,15 @@ class View implements ArrayAccess {
*/ */
public function with($key, $value) public function with($key, $value)
{ {
$this->data[$key] = $value; if (is_array($key))
{
$this->data = array_merge($this->data, $key);
}
else
{
$this->data[$key] = $value;
}
return $this; return $this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment