This commit is contained in:
2022-03-15 10:52:21 +01:00
parent 12814f64d4
commit ef94f03cde
476 changed files with 4612 additions and 1563 deletions

View File

@@ -3,7 +3,7 @@
/**
* @package Grav\Common\Page
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -84,7 +84,7 @@ class Page implements PageInterface
protected $unpublish_date;
/** @var string */
protected $slug;
/** @var string */
/** @var string|null */
protected $route;
/** @var string|null */
protected $raw_route;
@@ -196,7 +196,7 @@ class Page implements PageInterface
}
// extract page language from page extension
$language = trim(basename($this->extension(), 'md'), '.') ?: null;
$language = trim(Utils::basename($this->extension(), 'md'), '.') ?: null;
$this->language($language);
$this->hide_home_route = $config->get('system.home.hide_in_urls', false);
@@ -218,6 +218,7 @@ class Page implements PageInterface
return $this;
}
#[\ReturnTypeWillChange]
public function __clone()
{
$this->initialized = false;
@@ -387,7 +388,7 @@ class Page implements PageInterface
* Gets and Sets the header based on the YAML configuration at the top of the .md file
*
* @param object|array|null $var a YAML object representing the configuration for the file
* @return object the current YAML configuration
* @return \stdClass the current YAML configuration
*/
public function header($var = null)
{
@@ -1246,6 +1247,17 @@ class Page implements PageInterface
return $blueprint;
}
/**
* Returns the blueprint from the page.
*
* @param string $name Not used.
* @return Blueprint Returns a Blueprint.
*/
public function getBlueprint(string $name = '')
{
return $this->blueprints();
}
/**
* Get the blueprint name for this page. Use the blueprint form field if set
*
@@ -1453,7 +1465,7 @@ class Page implements PageInterface
$this->extension = $var;
}
if (empty($this->extension)) {
$this->extension = '.' . pathinfo($this->name(), PATHINFO_EXTENSION);
$this->extension = '.' . Utils::pathinfo($this->name(), PATHINFO_EXTENSION);
}
return $this->extension;
@@ -2097,9 +2109,9 @@ class Page implements PageInterface
{
if ($var !== null) {
// Filename of the page.
$this->name = basename($var);
$this->name = Utils::basename($var);
// Folder of the page.
$this->folder = basename(dirname($var));
$this->folder = Utils::basename(dirname($var));
// Path to the page.
$this->path = dirname($var, 2);
}
@@ -2138,7 +2150,7 @@ class Page implements PageInterface
{
if ($var !== null) {
// Folder of the page.
$this->folder = basename($var);
$this->folder = Utils::basename($var);
// Path to the page.
$this->path = dirname($var);
}