Файл: concrete5.7.5.6/concrete/src/Page/Type/PublishTarget/Type/ParentPageType.php
Строк: 56
<?php
namespace ConcreteCorePageTypePublishTargetType;
use Loader;
use ConcreteCorePageTypeType as PageType;
use Page;
use ConcreteCorePageTypePublishTargetConfigurationParentPageConfiguration;
use SymfonyComponentHttpFoundationRequest;
class ParentPageType extends Type {
public function configurePageTypePublishTarget(PageType $pt, $post) {
$configuration = new ParentPageConfiguration($this);
$configuration->setParentPageID($post['cParentID']);
return $configuration;
}
public function configurePageTypePublishTargetFromImport($txml) {
$configuration = new ParentPageConfiguration($this);
$path = (string) $txml['path'];
if (!$path) {
$c = Page::getByID(HOME_CID);
} else {
$c = Page::getByPath($path);
}
$configuration->setParentPageID($c->getCollectionID());
return $configuration;
}
public function validatePageTypeRequest(Request $request)
{
$e = parent::validatePageTypeRequest($request);
$page = Page::getByID($request->request->get('cParentID'));
if (!is_object($page) || $page->isError()) {
$e->add(t('You must choose a valid parent page for pages of this type.'));
}
return $e;
}
}