forked from annaesvensson/yellow-draft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraft.php
More file actions
29 lines (25 loc) · 994 Bytes
/
Copy pathdraft.php
File metadata and controls
29 lines (25 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
// Draft extension, https://github.com/annaesvensson/yellow-draft
class YellowDraft {
const VERSION = "0.8.17";
public $yellow; // access to API
// Handle initialisation
public function onLoad($yellow) {
$this->yellow = $yellow;
}
// Handle page meta data
public function onParseMetaData($page) {
if ($page->get("status")=="draft") $page->visible = false;
}
// Handle page layout
public function onParsePageLayout($page, $name) {
if ($this->yellow->page->get("status")=="draft" && $this->yellow->getRequestHandler()=="core") {
$errorMessage = "";
if ($this->yellow->extension->isExisting("edit")) {
$errorMessage .= "<a href=\"".$this->yellow->page->get("editPageUrl")."\">";
$errorMessage .= $this->yellow->language->getText("draftPageError")."</a>";
}
$this->yellow->page->error(420, $errorMessage);
}
}
}