/
edit_external.php
39 lines (34 loc) · 1.23 KB
/
edit_external.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
<?php
namespace Concrete\Controller\Dialog\Page;
use Concrete\Controller\Backend\UserInterface\Page as BackendInterfacePageController;
use Concrete\Core\Page\EditResponse;
class EditExternal extends BackendInterfacePageController
{
protected $viewPath = '/dialogs/page/add_external';
protected function canAccess()
{
return $this->permissions->canDeletePage() && $this->page->isExternalLink();
}
public function view()
{
$this->set('name', $this->page->getCollectionName());
$this->set('link', $this->page->getCollectionPointerExternalLink());
$this->set('openInNewWindow', $this->page->openCollectionPointerExternalLinkInNewWindow());
}
public function submit()
{
if ($this->validateAction()) {
$c = $this->page;
$request = \Request::getInstance();
$this->page->updateCollectionAliasExternal(
$request->request->get('name'),
$request->request->get('link'),
$request->request->get('openInNewWindow')
);
$pr = new EditResponse();
$pr->setMessage(t('External Link updated.'));
$pr->setPage($c);
$pr->outputJSON();
}
}
}