diff --git a/application/helpers/html_helper.php b/application/helpers/html_helper.php
index 798e4a53..9da0ee36 100644
--- a/application/helpers/html_helper.php
+++ b/application/helpers/html_helper.php
@@ -28,19 +28,19 @@ if ( ! function_exists('component'))
* @param string $component Component template file name.
* @param string $attributes HTML attributes for the parent component element.
* @param array $params Additional parameters for the component.
- * @param bool $return Whether to return the HTML or echo it directly.
- *
- * @return string Return the HTML if the $return argument is TRUE or NULL.
+ * @param bool $return Whether to return the HTML or echo it directly.
+ *
+ * @return string Return the HTML if the $return argument is TRUE or NULL.
*/
function component(string $component, string $attributes = '', array $params = [], bool $return = FALSE)
{
/** @var EA_Controller $CI */
$CI = get_instance();
-
+
$vars = array_merge($params, [
'attributes' => $attributes
]);
-
+
return $CI->load->view('components/' . $component, $vars, $return);
}
}
@@ -90,14 +90,14 @@ if ( ! function_exists('section'))
if (array_key_exists($name, $layout['sections']))
{
- $layout['sections'][$name] = ob_get_clean();
+ $layout['sections'][$name][] = ob_get_clean();
config(['layout' => $layout]);
return;
}
- $layout['sections'][$name] = '';
+ $layout['sections'][$name] = [];
config(['layout' => $layout]);
@@ -116,6 +116,16 @@ if ( ! function_exists('slot'))
{
$layout = config('layout');
- echo $layout['sections'][$name] ?? '';
+ $section = $layout['sections'][$name] ?? NULL;
+
+ if ( ! $section)
+ {
+ return;
+ }
+
+ foreach ($section as $content)
+ {
+ echo $content;
+ }
}
}