Commit 0e4a6360 authored by Taylor Otwell's avatar Taylor Otwell

Added render_each helper.

parent e04b7a3a
......@@ -18,7 +18,6 @@ class Blade {
'yields',
'section_start',
'section_end',
'render_each',
);
/**
......@@ -239,19 +238,6 @@ class Blade {
return preg_replace('/@endsection/', '<?php \\Laravel\\Section::stop(); ?>', $value);
}
/**
* Rewrites Blade @render_each statements into View statements.
*
* @param string $value
* @return string
*/
protected static function compile_render_each($value)
{
$pattern = static::matcher('render_each');
return preg_replace($pattern, '$1<?php \\Laravel\\View::render_each$2; ?>', $value);
}
/**
* Get the regular expression for a generic Blade function.
*
......
......@@ -437,3 +437,17 @@ function render($view, $data = array())
{
return Laravel\View::make($view, $data)->render();
}
/**
* Get the rendered contents of a partial from a loop.
*
* @param string $view
* @param array $data
* @param string $iterator
* @param string $empty
* @return string
*/
function render_each($partial, array $data, $iterator, $empty = 'raw|')
{
return Laravel\View::render_each($partial, $data, $iterator, $empty);
}
\ No newline at end of file
......@@ -232,7 +232,7 @@ class View implements ArrayAccess {
* @param string $empty
* @return string
*/
public static function render_each($view, array $data, $iterator, $empty = null)
public static function render_each($view, array $data, $iterator, $empty = 'raw|')
{
$result = '';
......@@ -260,7 +260,7 @@ class View implements ArrayAccess {
}
else
{
$result = render($empty ?: $view.'_empty');
$result = render($empty);
}
}
......
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