Skip to content

Commit

Permalink
fix parent placeholding
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 24, 2017
1 parent 17a46cd commit 64f7e9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/View/Concerns/ManagesLayouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait ManagesLayouts
*
* @var string
*/
protected static $parentPlaceholder;
protected static $parentPlaceholder = [];

/**
* Start injecting content into a section.
Expand Down Expand Up @@ -164,11 +164,11 @@ public function yieldContent($section, $default = '')
*/
public static function parentPlaceholder($section = '')
{
if (! static::$parentPlaceholder) {
static::$parentPlaceholder = '##parent-placeholder-'.sha1($section).'##';
if (! isset(static::$parentPlaceholder[$section])) {
static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##';
}

return static::$parentPlaceholder;
return static::$parentPlaceholder[$section];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/View/ViewFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function testBasicSectionHandling()

public function testSectionExtending()
{
$placeholder = \Illuminate\View\Factory::parentPlaceholder();
$placeholder = \Illuminate\View\Factory::parentPlaceholder('foo');
$factory = $this->getFactory();
$factory->startSection('foo');
echo 'hi '.$placeholder;
Expand All @@ -226,7 +226,7 @@ public function testSectionExtending()

public function testSectionMultipleExtending()
{
$placeholder = \Illuminate\View\Factory::parentPlaceholder();
$placeholder = \Illuminate\View\Factory::parentPlaceholder('foo');
$factory = $this->getFactory();
$factory->startSection('foo');
echo 'hello '.$placeholder.' nice to see you '.$placeholder;
Expand Down

0 comments on commit 64f7e9c

Please sign in to comment.