mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Merge branch 'develop' of github.com:getgrav/grav into develop
This commit is contained in:
commit
9b2af98b0b
2
.github/workflows/tests.yaml
vendored
2
.github/workflows/tests.yaml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
php: [ 8.0, 7.4, 7.3]
|
||||
php: [ 8.1, 8.0, 7.4, 7.3]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* Added support for generic `assets.link()` for external references. No pipeline support
|
||||
* Added support for `assets.addJsModule()` with full pipeline support
|
||||
* Added `Utils::getExtensionsByMime()` method to get all the registered extensions for the specific mime type
|
||||
* Added `Media::getRoute()` and `Media::getRawRoute()` methods to get page route if available
|
||||
2. [](#improved)
|
||||
* Improved `Utils::download()` method to allow overrides on download name, mime and expires header
|
||||
* Improved `onPageFallBackUrl` event
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Grav is a **Fast**, **Simple**, and **Flexible**, file-based Web-platform. Ther
|
|||
|
||||
The underlying architecture of Grav is designed to use well-established and _best-in-class_ technologies to ensure that Grav is simple to use and easy to extend. Some of these key technologies include:
|
||||
|
||||
* [Twig Templating](https://twig.sensiolabs.org/): for powerful control of the user interface
|
||||
* [Twig Templating](https://twig.symfony.com/): for powerful control of the user interface
|
||||
* [Markdown](https://en.wikipedia.org/wiki/Markdown): for easy content creation
|
||||
* [YAML](https://yaml.org): for simple configuration
|
||||
* [Parsedown](https://parsedown.org/): for fast Markdown and Markdown Extra support
|
||||
|
|
|
|||
|
|
@ -60,6 +60,46 @@ class Media extends AbstractMedia
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return raw route to the page.
|
||||
*
|
||||
* @return string|null Route to the page or null if media isn't for a page.
|
||||
*/
|
||||
public function getRawRoute(): ?string
|
||||
{
|
||||
$path = $this->getPath();
|
||||
if ($path) {
|
||||
/** @var Pages $pages */
|
||||
$pages = $this->getGrav()['pages'];
|
||||
$page = $pages->get($path);
|
||||
if ($page) {
|
||||
return $page->rawRoute();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return page route.
|
||||
*
|
||||
* @return string|null Route to the page or null if media isn't for a page.
|
||||
*/
|
||||
public function getRoute(): ?string
|
||||
{
|
||||
$path = $this->getPath();
|
||||
if ($path) {
|
||||
/** @var Pages $pages */
|
||||
$pages = $this->getGrav()['pages'];
|
||||
$page = $pages->get($path);
|
||||
if ($page) {
|
||||
return $page->route();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $offset
|
||||
* @return bool
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user