Added RouteFactory::createFromString() rename MarkdownFormatter configuration option

This commit is contained in:
Matias Griese
2018-04-27 20:41:05 +03:00
parent 1cef2a182a
commit 91e98cd32e
2 changed files with 19 additions and 2 deletions

View File

@@ -22,10 +22,10 @@ class MarkdownFormatter implements FormatterInterface
'header' => 'header',
'body' => 'markdown',
'raw' => 'frontmatter',
'formatter' => ['inline' => 20]
'yaml' => ['inline' => 20]
];
$this->headerFormatter = $headerFormatter ?: new YamlFormatter($this->config['formatter']);
$this->headerFormatter = $headerFormatter ?: new YamlFormatter($this->config['yaml']);
}
/**

View File

@@ -28,6 +28,23 @@ class RouteFactory
return new Route($parts);
}
public static function createFromString($path)
{
$path = ltrim($path, '/');
$parts = [
'path' => $path,
'query' => '',
'query_params' => [],
'grav' => [
'root' => self::$root,
'language' => self::$language,
'route' => $path,
'params' => ''
],
];
return new Route($parts);
}
public static function getRoot()
{
return self::$root;