Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #196 from woolfg/yieldproblem
Browse files Browse the repository at this point in the history
Yieldproblem
  • Loading branch information
mikelbring committed Feb 27, 2014
2 parents 8b9e91b + 2c4e3b2 commit f9e7ac6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/laravel/blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ protected static function compile_render_each($value)
*/
protected static function compile_yields($value)
{
$pattern = static::matcher('yield');
$pattern = static::matcher('yieldContent');

return preg_replace($pattern, '$1<?php echo \\Laravel\\Section::yield$2; ?>', $value);
return preg_replace($pattern, '$1<?php echo \\Laravel\\Section::yieldContent$2; ?>', $value);
}

/**
Expand Down Expand Up @@ -449,4 +449,4 @@ public static function compiled($path)
return path('storage').'views/'.md5($path);
}

}
}
4 changes: 2 additions & 2 deletions app/laravel/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ function render_each($partial, array $data, $iterator, $empty = 'raw|')
* @param string $section
* @return string
*/
function yield($section)
function yieldContent($section)
{
return Laravel\Section::yield($section);
return Laravel\Section::yieldContent($section);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/laravel/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public static function inject($section, $content)
*
* @return string
*/
public static function yield_section()
public static function yieldContent_section()
{
return static::yield(static::stop());
return static::yieldContent(static::stop());
}

/**
Expand Down Expand Up @@ -128,7 +128,7 @@ public static function append($section, $content)
* @param string $section
* @return string
*/
public static function yield($section)
public static function yieldContent($section)
{
return (isset(static::$sections[$section])) ? static::$sections[$section] : '';
}
Expand Down
6 changes: 3 additions & 3 deletions app/laravel/tests/cases/blade.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public function testControlStructuresAreCreatedCorrectly()
}

/**
* Test the compilation of yield statements.
* Test the compilation of yieldContent statements.
*
* @group laravel
*/
public function testYieldsAreCompiledCorrectly()
{
$blade = "@yield('something')";
$blade = "@yieldContent('something')";

$this->assertEquals("<?php echo \\Laravel\\Section::yield('something'); ?>", Blade::compile_string($blade));
$this->assertEquals("<?php echo \\Laravel\\Section::yieldContent('something'); ?>", Blade::compile_string($blade));
}

/**
Expand Down

0 comments on commit f9e7ac6

Please sign in to comment.