Skip to content

Commit

Permalink
Added RouteFactory::createFromString() rename MarkdownFormatter con…
Browse files Browse the repository at this point in the history
…figuration option
  • Loading branch information
mahagr committed Apr 27, 2018
1 parent 1cef2a1 commit 91e98cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public function __construct(array $config = [], FormatterInterface $headerFormat
'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']);
}

/**
Expand Down
17 changes: 17 additions & 0 deletions system/src/Grav/Framework/Route/RouteFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ public static function createFromParts($parts)
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;
Expand Down

0 comments on commit 91e98cd

Please sign in to comment.