Upgrade to 3.3.5
This commit is contained in:
@@ -693,24 +693,6 @@ class Page extends ModelWithContent
|
||||
return $this->id() === $this->site()->errorPageId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the page can be read by the current user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isReadable(): bool
|
||||
{
|
||||
static $readable = [];
|
||||
|
||||
$template = $this->intendedTemplate()->name();
|
||||
|
||||
if (isset($readable[$template]) === true) {
|
||||
return $readable[$template];
|
||||
}
|
||||
|
||||
return $readable[$template] = $this->permissions()->can('read');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the page is the home page
|
||||
*
|
||||
@@ -776,6 +758,34 @@ class Page extends ModelWithContent
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the page is not a draft.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPublished(): bool
|
||||
{
|
||||
return $this->isDraft() === false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the page can be read by the current user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isReadable(): bool
|
||||
{
|
||||
static $readable = [];
|
||||
|
||||
$template = $this->intendedTemplate()->name();
|
||||
|
||||
if (isset($readable[$template]) === true) {
|
||||
return $readable[$template];
|
||||
}
|
||||
|
||||
return $readable[$template] = $this->permissions()->can('read');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the page is sortable
|
||||
*
|
||||
@@ -1128,8 +1138,6 @@ class Page extends ModelWithContent
|
||||
|
||||
// fetch the page regularly
|
||||
if ($html === null) {
|
||||
$kirby->data = $this->controller($data, $contentType);
|
||||
|
||||
if ($contentType === 'html') {
|
||||
$template = $this->template();
|
||||
} else {
|
||||
@@ -1142,6 +1150,8 @@ class Page extends ModelWithContent
|
||||
]);
|
||||
}
|
||||
|
||||
$kirby->data = $this->controller($data, $contentType);
|
||||
|
||||
// render the page
|
||||
$html = $template->render($kirby->data);
|
||||
|
||||
@@ -1168,7 +1178,7 @@ class Page extends ModelWithContent
|
||||
public function representation($type)
|
||||
{
|
||||
$kirby = $this->kirby();
|
||||
$template = $this->intendedTemplate();
|
||||
$template = $this->template();
|
||||
$representation = $kirby->template($template->name(), $type);
|
||||
|
||||
if ($representation->exists() === true) {
|
||||
|
Reference in New Issue
Block a user