added support for bundles outside of the bundle directory using 'path: ' syntax like views.
This commit is contained in:
parent
0f483fb390
commit
44dbbe01da
|
@ -118,7 +118,7 @@ public static function compile_string($value, $view = null)
|
||||||
protected static function compile_layouts($value)
|
protected static function compile_layouts($value)
|
||||||
{
|
{
|
||||||
// If the Blade template is not using "layouts", we'll just return it
|
// If the Blade template is not using "layouts", we'll just return it
|
||||||
// it unchanged since there is nothing to do with layouts and we'll
|
// unchanged since there is nothing to do with layouts and we will
|
||||||
// just let the other Blade compilers handle the rest.
|
// just let the other Blade compilers handle the rest.
|
||||||
if ( ! starts_with($value, '@layout'))
|
if ( ! starts_with($value, '@layout'))
|
||||||
{
|
{
|
||||||
|
@ -126,8 +126,8 @@ protected static function compile_layouts($value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// First we'll split out the lines of the template so we can get the
|
// First we'll split out the lines of the template so we can get the
|
||||||
// the layout from the top of the template. By convention it must
|
// layout from the top of the template. By convention it must be
|
||||||
// be located on the first line of the template contents.
|
// located on the first line of the template contents.
|
||||||
$lines = preg_split("/(\r?\n)/", $value);
|
$lines = preg_split("/(\r?\n)/", $value);
|
||||||
|
|
||||||
$pattern = static::matcher('layout');
|
$pattern = static::matcher('layout');
|
||||||
|
@ -135,7 +135,7 @@ protected static function compile_layouts($value)
|
||||||
$lines[] = preg_replace($pattern, '$1@include$2', $lines[0]);
|
$lines[] = preg_replace($pattern, '$1@include$2', $lines[0]);
|
||||||
|
|
||||||
// We will add a "render" statement to the end of the templates and
|
// We will add a "render" statement to the end of the templates and
|
||||||
// and then slice off the @layout shortcut from the start so the
|
// then slice off the "@layout" shortcut from the start so the
|
||||||
// sections register before the parent template renders.
|
// sections register before the parent template renders.
|
||||||
return implode(CRLF, array_slice($lines, 1));
|
return implode(CRLF, array_slice($lines, 1));
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,8 @@ protected static function compile_forelse($value)
|
||||||
$blade = preg_replace($search, $replace, $forelse);
|
$blade = preg_replace($search, $replace, $forelse);
|
||||||
|
|
||||||
// Finally, once we have the check prepended to the loop we'll replace
|
// Finally, once we have the check prepended to the loop we'll replace
|
||||||
// all instances of this "forelse" syntax in the view content of the
|
// all instances of this forelse syntax in the view content of the
|
||||||
// view being compiled to Blade syntax with real syntax.
|
// view being compiled to Blade syntax with real PHP syntax.
|
||||||
$value = str_replace($forelse, $blade, $value);
|
$value = str_replace($forelse, $blade, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,9 +271,19 @@ public static function path($bundle)
|
||||||
{
|
{
|
||||||
return path('app');
|
return path('app');
|
||||||
}
|
}
|
||||||
else if ($location = array_get(static::$bundles, $bundle.'.location'))
|
elseif ($location = array_get(static::$bundles, $bundle.'.location'))
|
||||||
{
|
{
|
||||||
return str_finish(path('bundle').$location, DS);
|
// If the bundle location starts with "path: ", we will assume that a raw
|
||||||
|
// path has been specified and will simply return it. Otherwise, we'll
|
||||||
|
// prepend the bundle directory path onto the location and return.
|
||||||
|
if (starts_with($location, 'path: '))
|
||||||
|
{
|
||||||
|
return str_finish(substr($location, 6), DS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return str_finish(path('bundle').$location, DS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,8 +384,8 @@ public static function resolve($bundle)
|
||||||
public static function parse($identifier)
|
public static function parse($identifier)
|
||||||
{
|
{
|
||||||
// The parsed elements are cached so we don't have to reparse them on each
|
// The parsed elements are cached so we don't have to reparse them on each
|
||||||
// subsequent request for the parsed element. So, if we've already parsed
|
// subsequent request for the parsed element. So if we've already parsed
|
||||||
// the given element, we'll just return the cached copy.
|
// the given element, we'll just return the cached copy as the value.
|
||||||
if (isset(static::$elements[$identifier]))
|
if (isset(static::$elements[$identifier]))
|
||||||
{
|
{
|
||||||
return static::$elements[$identifier];
|
return static::$elements[$identifier];
|
||||||
|
@ -387,7 +397,7 @@ public static function parse($identifier)
|
||||||
}
|
}
|
||||||
// If no bundle is in the identifier, we will insert the default bundle
|
// If no bundle is in the identifier, we will insert the default bundle
|
||||||
// since classes like Config and Lang organize their items by bundle.
|
// since classes like Config and Lang organize their items by bundle.
|
||||||
// The "application" folder essentially behaves as a bundle.
|
// The application folder essentially behaves as a default bundle.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$element = array(DEFAULT_BUNDLE, strtolower($identifier));
|
$element = array(DEFAULT_BUNDLE, strtolower($identifier));
|
||||||
|
|
|
@ -33,6 +33,7 @@ ## Laravel 3.2
|
||||||
- [Added `unless` structure to Blade template engine](/docs/views/templating#blade-unless).
|
- [Added `unless` structure to Blade template engine](/docs/views/templating#blade-unless).
|
||||||
- [Added Blade comments](/docs/views/templating#blade-comments).
|
- [Added Blade comments](/docs/views/templating#blade-comments).
|
||||||
- [Added simpler environment management](/docs/install#environments).
|
- [Added simpler environment management](/docs/install#environments).
|
||||||
|
- Added support for bundles outside of the bundle directory.
|
||||||
- Added support for DateTime database query bindings.
|
- Added support for DateTime database query bindings.
|
||||||
- Migrated to the Symfony HttpFoundation component for core request / response handling.
|
- Migrated to the Symfony HttpFoundation component for core request / response handling.
|
||||||
- Fixed the passing of strings into the `Input::except` method.
|
- Fixed the passing of strings into the `Input::except` method.
|
||||||
|
|
Loading…
Reference in New Issue