|
@@ -39,7 +39,7 @@ class Section {
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- static::append($section, $content);
|
|
|
|
|
|
+ static::extend($section, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -79,19 +79,20 @@ class Section {
|
|
*/
|
|
*/
|
|
public static function stop()
|
|
public static function stop()
|
|
{
|
|
{
|
|
- static::append($last = array_pop(static::$last), ob_get_clean());
|
|
|
|
|
|
+ static::extend($last = array_pop(static::$last), ob_get_clean());
|
|
|
|
|
|
return $last;
|
|
return $last;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Append content to a given section.
|
|
|
|
|
|
+ * Extend the content in a given section.
|
|
|
|
+ * The old content can be injected into the new using "@parent".
|
|
*
|
|
*
|
|
* @param string $section
|
|
* @param string $section
|
|
* @param string $content
|
|
* @param string $content
|
|
* @return void
|
|
* @return void
|
|
*/
|
|
*/
|
|
- protected static function append($section, $content)
|
|
|
|
|
|
+ protected static function extend($section, $content)
|
|
{
|
|
{
|
|
if (isset(static::$sections[$section]))
|
|
if (isset(static::$sections[$section]))
|
|
{
|
|
{
|
|
@@ -103,6 +104,26 @@ class Section {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Append content to a given section.
|
|
|
|
+ * This concatenates the old content and the new.
|
|
|
|
+ *
|
|
|
|
+ * @param string $section
|
|
|
|
+ * @param string $content
|
|
|
|
+ * @return void
|
|
|
|
+ */
|
|
|
|
+ public static function append($section, $content)
|
|
|
|
+ {
|
|
|
|
+ if (isset(static::$sections[$section]))
|
|
|
|
+ {
|
|
|
|
+ static::$sections[$section] .= $content;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ static::$sections[$section] = $content;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get the string contents of a section.
|
|
* Get the string contents of a section.
|
|
*
|
|
*
|