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
...@@ -28,3 +28,6 @@ Changes for 3.1: ...@@ -28,3 +28,6 @@ Changes for 3.1:
- 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
- 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.
...@@ -451,3 +451,14 @@ function render_each($partial, array $data, $iterator, $empty = 'raw|') ...@@ -451,3 +451,14 @@ 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;
// 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); $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
*/ */
...@@ -380,8 +391,16 @@ class View implements ArrayAccess { ...@@ -380,8 +391,16 @@ class View implements ArrayAccess {
* @return View * @return View
*/ */
public function with($key, $value) public function with($key, $value)
{
if (is_array($key))
{
$this->data = array_merge($this->data, $key);
}
else
{ {
$this->data[$key] = $value; $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