Support multiple additions of the same section content
This commit is contained in:
parent
cd2fe86aa3
commit
0a005d570b
1 changed files with 18 additions and 8 deletions
|
@ -90,14 +90,14 @@ if ( ! function_exists('section'))
|
||||||
|
|
||||||
if (array_key_exists($name, $layout['sections']))
|
if (array_key_exists($name, $layout['sections']))
|
||||||
{
|
{
|
||||||
$layout['sections'][$name] = ob_get_clean();
|
$layout['sections'][$name][] = ob_get_clean();
|
||||||
|
|
||||||
config(['layout' => $layout]);
|
config(['layout' => $layout]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout['sections'][$name] = '';
|
$layout['sections'][$name] = [];
|
||||||
|
|
||||||
config(['layout' => $layout]);
|
config(['layout' => $layout]);
|
||||||
|
|
||||||
|
@ -116,6 +116,16 @@ if ( ! function_exists('slot'))
|
||||||
{
|
{
|
||||||
$layout = config('layout');
|
$layout = config('layout');
|
||||||
|
|
||||||
echo $layout['sections'][$name] ?? '';
|
$section = $layout['sections'][$name] ?? NULL;
|
||||||
|
|
||||||
|
if ( ! $section)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($section as $content)
|
||||||
|
{
|
||||||
|
echo $content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue