/
PublishTargetCorePageProperty.php
46 lines (39 loc) · 1.3 KB
/
PublishTargetCorePageProperty.php
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Concrete\Core\Page\Type\Composer\Control\CorePageProperty;
use Concrete\Core\Attribute\FontAwesomeIconFormatter;
class PublishTargetCorePageProperty extends CorePageProperty
{
public function __construct()
{
$this->setCorePagePropertyHandle('publish_target');
$this->setPageTypeComposerControlIconFormatter(new FontAwesomeIconFormatter('download'));
}
public function getPageTypeComposerControlName()
{
return tc('PageTypeComposerControlName', 'Page Location');
}
public function pageTypeComposerFormControlSupportsValidation()
{
return false;
}
public function getPageTypeComposerControlDraftValue()
{
if (is_object($this->page)) {
if ($this->page->isPageDraft()) {
return $this->page->getPageDraftTargetParentPageID();
} else {
return $this->page->getCollectionParentID();
}
} elseif ($this->getTargetParentPageID()) {
return $this->getTargetParentPageID();
}
}
public function render($label, $customTemplate, $description)
{
{
if (!is_object($this->page) || $this->page->isPageDraft()) {
parent::render($label, $customTemplate, $description);
}
}
}
}