{@inheritDoc}

Creates a new page using a page class.
330156
public final <C extends IRequestablePage> C newPage(final Class<C> pageClass) {
        PageFactory<C> content = getFactory(pageClass);
        if (content != null) {
            return content.createPage(new PageParameters());
        }
        return new DefaultPageFactory().newPage(pageClass);
    }
52281
public function createClone(Page $originPage = null)
    {
        $class = ClassUtils::getRealClass($this);
        $clone = new $class(null, null);
        $clone->_accept = self::getShortClassname($this->_accept);
        $clone->_maxentry = $this->_maxentry;
        $clone->_minentry = $this->_minentry;
        $clone->_parameters = $this->_parameters;
        $clone->_mainnode = $this->_mainnode;

        if (
            null !== $originPage
            && is_array($originPage->cloningData)
            && array_key_exists('contents', $originPage->cloningData)
        ) {
            $originPage->cloningData['contents'][$this->getUid()] = $clone;
        }

        if (!($this instanceof ContentSet)) {
            foreach ($this->_data as $key => $values) {
                foreach ($values as $type => &$value) {
                    if (is_array($value)) {
                        $keys = array_keys($value);
                        $values = array_values($value);

                        $type = end($keys);
                        $value = end($values);
                    }

                    if ('scalar' === $type) {
                        $decode = json_decode($value, true);
                        $clone->$key = (JSON_ERROR_NONE === json_last_error()) ? ((null === $decode) ? $value : $decode) : $value;
                    } elseif ('array' !== $type) {
                        foreach ($this->_subcontent as $subcontent) {
                            if ($subcontent->getUid() == $value) {
                                $newsubcontent = $subcontent->createClone($originPage);
                                $clone->$key = $newsubcontent;
                                break;
                            }
                        }
                    } else {
                        $clone->$key = $value;
                    }
                }
                unset($value);
            }
        }

        return $clone;
    }
879328
public function CreatePage() 
	{ 
		$myWords = $this->WordCollection();
		
		$this->defaultXmlnukeDocument = new XmlnukeDocument($myWords->Value("TITLE"),$myWords->Value("ABSTRACT"));
		
		$blockcenter = new XmlBlockCollection($myWords->Value("TITLE"), BlockPosition::Center );
		$this->defaultXmlnukeDocument->addXmlnukeObject($blockcenter);
		
		$paragraph = new XmlParagraphCollection();
		$blockcenter->addXmlnukeObject($paragraph);

		$xslUsed = array();

		$xsl = new XSLFilenameProcessor("");
		$filelist = FileUtil::RetrieveFilesFromFolder($xsl->PrivatePath(), $xsl->Extension());
		$this->generateList($myWords->Value("LISTPERSONAL"), $paragraph, $filelist, $xslUsed, $xsl);

		$filelist = FileUtil::RetrieveFilesFromFolder($xsl->SharedPath(), $xsl->Extension());
		$this->generateList($myWords->Value("LISTGENERIC"), $paragraph, $filelist, $xslUsed, $xsl);
		
		return $this->defaultXmlnukeDocument->generatePage();
	}
598882
public function createPageBasedPagination(int $defaultPage = 0, int $defaultSize = 0): PageBasedPagination
    {
        return PageBasedPagination::fromPaginationQueryParams($this->request->getPagination(), $defaultPage, $defaultSize);
    }
382753
@Override
    protected void startNewPage()
    {
        super.startNewPage();
        pagebox = createBlock(body, curpage, false);
        pagebox.setStyle(createPageStyle());
        body.addSubBox(pagebox);
    }
108815
public function createPager($page, $limit = null)
    {
        $limit = $limit !== null ? $limit : $this->defaultLimit;

        return new Pager($page, $limit);
    }
158187
public function createAction()
	{
		$this->isPostRequest();

		$type = $this->getRequestParameter('type');

		$page = null;

		switch ($type) {
			case Entity::APPLICATION_DISCR:
				$page = new ApplicationPage(
						$this->getRequestParameter('application_id')
				);
				break;
			case Entity::PAGE_DISCR:
				$page = new Page();
				break;
			default:
				throw new \InvalidArgumentException(sprintf('Unknown page type [%s]', $type));
		}

		$localeId = $this->getCurrentLocale()->getId();

		$localization = Localization::factory($page, $localeId);
		/* @var $localization PageLocalization */

		if (! $localization instanceof PageLocalization) {
			throw new \UnexpectedValueException(sprintf(
					'Expecting created localization to be instance of PageLocalization, [%s] received.',
					get_class($localization)
			));
		}

		$templateId = $this->getRequestParameter('template');
		
		$template = $this->getEntityManager()
				->find(Template::CN(), $templateId);
		/* @var $template Template */

		if ($template === null) {
			throw new CmsException(null, 'Template not specified or found.');
		}

		$templateLocalization = $template->getLocalization($localeId);

		if ($templateLocalization === null) {
			throw new \InvalidArgumentException(
					"Specified template has no localization for [{$localeId}] locale."
			);
		}

		$localization->setTemplate($template);

		// copy values from template
		$localization->setIncludedInSearch($templateLocalization->isIncludedInSearch());
		$localization->setVisibleInMenu($templateLocalization->isVisibleInMenu());
		$localization->setVisibleInSitemap($templateLocalization->isVisibleInSitemap());

		$title = trim($this->getRequestParameter('title', ''));

		if (empty($title)) {
			throw new CmsException(null, 'Page title cannot be empty.');
		}
		
		$localization->setTitle($title);

		$parentLocalization = $pathPart
				= null;

		$parentLocalizationId = $this->getRequestParameter('parent_id');
		
		if (! empty($parentLocalizationId)) {

			$parentLocalization = $this->getEntityManager()
					->find(Localization::CN(), $parentLocalizationId);

			if ($parentLocalization === null) {
				throw new CmsException(null, sprintf(
						'Specified parent page [%s] not found.',
						$parentLocalizationId
				));
			}

			$pathPart = trim($this->getRequestParameter('path'));

			// path part cannot be empty for non-root pages.
			if (empty($pathPart)) {
				throw new CmsException(null, 'Page path can not be empty.');
			}
		}

		if ($parentLocalization && $pathPart) {
			$localization->setPathPart($pathPart);
		} else {
			$rootPath = $localization->getPathEntity();
			$rootPath->setPath('');
			$localization->setPathPart('');
		}

		$entityManager = $this->getEntityManager();

		$entityManager->transactional(function (EntityManager $entityManager) use ($page, $localization, $parentLocalization) {

			$this->lockNestedSet($page);

			$entityManager->persist($page);
			$entityManager->persist($localization);

			if ($parentLocalization) {
				$page->moveAsLastChildOf($parentLocalization->getMaster());
			}

			$this->unlockNestedSet($page);
		});

		return new SupraJsonResponse($this->loadNodeMainData($localization));
	}
971924
public PageResult<Entity> page(Entity where, int page, int numPerPage) throws SQLException {
		return this.page(where, new Page(page, numPerPage));
	}
1365307
public function newAction()
    {
        $entity = new Page();
        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
981859
public function create($pageObjectClass)
    {
        $decoratedFactory = $this->decoratedFactory;

        $initializer = function (&$wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, &$initializer) use ($pageObjectClass, $decoratedFactory) {
            $initializer = null;

            $wrappedObject = $decoratedFactory->create($pageObjectClass);

            return true;
        };

        return $this->proxyFactory->createProxy($pageObjectClass, $initializer);
    }
1333290
public static PageRequestDto createPageRequestDto(final PageRequest pageRequest) {
        final PageRequestDto pageRequestDto;
        if (pageRequest == null) {
            pageRequestDto = null;
        } else if (pageRequest instanceof PageRequestDto) {
            pageRequestDto = (PageRequestDto) pageRequest;
        } else {
            pageRequestDto = new PageRequestDto(pageRequest);
        }
        return pageRequestDto;
    }
356165
public function findOrCreateFor(HasPageTemplateInterface $page)
    {
        $pageTemplateConfiguration = $this->repo->findFor($page);

        if (null === $pageTemplateConfiguration) {
            $pageTemplates = $this->reader->getPageTemplates($page);
            $names = array_keys($pageTemplates);
            $defaultPageTemplate = $pageTemplates[$names[0]];

            $pageTemplateConfiguration = new PageTemplateConfiguration();
            $pageTemplateConfiguration->setPageId($page->getId());
            $pageTemplateConfiguration->setPageEntityName(ClassLookup::getClass($page));
            $pageTemplateConfiguration->setPageTemplate($defaultPageTemplate->getName());
        }

        return $pageTemplateConfiguration;
    }
4967
public function newAction(Request $request)
    {
        $page = new Page();
        $form = $this->createForm('CoreBundle\Form\PageType', $page, array('translator'=>$this->get('translator')));
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($page);
            $em->flush($page);

            //if come from popup
            if ($request->isXMLHttpRequest()) {         
                return new JsonResponse(array(
                            'id' => $page->getId(), 
                        ));
            }
            $this->get('session')->getFlashBag()->add('success', 'page.created');
            
            return $this->redirectToRoute('core_page_index');
        }

        return array(
            'page' => $page,
            'form' => $form->createView(),
        );
    }
181663
public function add(Page $page)
    {
        $next = count($this->pages) + 1;

        $this->pages[$next] = $page;

        if ($page->isPlaceholder()) {
            $this->isSqueezed = true;
        }

        if ($page->isFirst()) {
            $this->firstPage = $page;
        }

        if ($page->isLast()) {
            $this->lastPage = $page;
        }

        if ($page->isCurrent()) {
            $this->currentPage = $page;
        }

        if ($page->isPrevious()) {
            $this->previousPage = $page;
        }

        if ($page->isNext()) {
            $this->nextPage = $page;
        }

        return $this;
    }
455235
public function getPage(string $name): Page
    {
        if ($this->page_object_factory === null) {
            throw new RuntimeException('[W406] To create pages you need to pass a factory with setPageObjectFactory()');
        }

        return $this->page_object_factory->createPage($name);
    }
10785
public function createPage(
        SiteEntity $site,
        $pageData,
        $publishPage = false,
        $doFlush = true
    ) {
        if (empty($pageData['createdByUserId'])) {
            throw new PageException('CreatedByUserId is required to create a page.');
        }
        if (empty($pageData['createdReason'])) {
            $pageData['createdReason'] = Tracking::UNKNOWN_REASON;
        }
        if (empty($pageData['author'])) {
            throw new PageException('Author is required to create a page.');
        }
        $revision = new Revision(
            $pageData['createdByUserId'],
            $pageData['createdReason']
        );
        $revision->setAuthor($pageData['author']);

        // we should not have an Id on page create
        unset($pageData['pageId']);

        $page = new PageEntity(
            $pageData['createdByUserId'],
            $pageData['createdReason']
        );
        $page->populate($pageData);

        $page->setSite($site);

        $this->assertCanCreateSitePage(
            $page->getSite(),
            $page->getName(),
            $page->getPageType()
        );

        if (!$publishPage) {
            $page->setStagedRevision($revision);
        } else {
            $page->setPublishedRevision($revision);
        }

        $page->addRevision($revision);

        $this->_em->persist($revision);
        $this->_em->persist($page);

        if ($doFlush) {
            $this->_em->flush(
                [
                    $revision,
                    $page
                ]
            );
        }

        return $page;
    }
682138
public function CreatePage()
	{
		parent::CreatePage();

		$this->myWords = $this->WordCollection();
		$this->setTitlePage($this->myWords->Value("TITLE"));
		$this->setHelp($this->myWords->Value("DESCRIPTION"));

		$block = new XmlBlockCollection($this->myWords->Value("BLOCK_TITLE"), BlockPosition::Center);

		$anydatafile = new AnydatasetFilenameProcessor("_db");

		if ($this->_action != "test")
		{

			$processfields = new CrudFieldCollection();

			$field = new CrudField();
			$field->fieldName = "dbname";
			$field->editable = true;
			$field->key = true;
			$field->visibleInList = true;
			$field->dataType = INPUTTYPE::TEXT;
			$field->fieldXmlInput = XmlInputObjectType::TEXTBOX;
			$field->fieldCaption = $this->myWords->Value("DBNAME");
			$field->size = 20;
			$field->maxLength = 20;
			$field->required = true;
			$field->newColumn = true;
			$processfields->addCrudField($field);

			$field = new CrudField();
			$field->fieldName = "dbtype";
			$field->editable = true;
			$field->key = false;
			$field->visibleInList = true;
			$field->dataType = INPUTTYPE::TEXT;
			$field->fieldXmlInput = XmlInputObjectType::SELECTLIST;
			$field->fieldCaption = $this->myWords->Value("DBTYPE");
			$field->size = 15;
			$field->maxLength = 15;
			$field->required = true;
			$field->arraySelectList = array("dsn"=>"dsn (use it)",
				"literal"=>"PDO Literal connection string",
				"dblib"=>"FreeTDS / Microsoft SQL Server / Sybase",
				"firebird"=>"Firebird/Interbase 6",
				"informix"=>"IBM Informix Dynamic Server",
				"mysql"=>"MySQL 3.x/4.x/5.x",
				"oci"=>"Oracle Call Interface",
				"odbc"=>"ODBC v3 (IBM DB2, unixODBC and win32 ODBC)",
				"pgsql"=>"PostgreSQL",
				"sqlite"=>"SQL Lite");
			$field->defaultValue = "dsn";
			$field->newColumn = true;
			$processfields->addCrudField($field);

			$field = new CrudField();
			$field->fieldName = "dbconnectionstring";
			$field->editable = true;
			$field->key = false;
			$field->visibleInList = true;
			$field->dataType = INPUTTYPE::TEXT;
			$field->fieldXmlInput = XmlInputObjectType::TEXTBOX;
			$field->fieldCaption = $this->myWords->Value("DBCONNECTIONSTRING");
			$field->size = 50;
			$field->maxLength = 200;
			$field->required = true;
			$field->defaultValue = "adodriver://username:password@server/datasource?persist";
			$field->newColumn = true;
			$processfields->addCrudField($field);

			$buttons = new CustomButtons();
			$buttons->action = "test";
			$buttons->alternateText = $this->myWords->Value("TESTALTERNATETEXT");
			$buttons->enabled = true;
			$buttons->icon = "common/editlist/ic_selecionar.gif";
			$buttons->message = $this->myWords->Value("TESTMESSAGETEXT");
			$buttons->multiple = MultipleSelectType::ONLYONE;

			$crud =
				new XmlnukeCrudAnydata(
					$this->_context,
					$processfields,
					$this->myWords->Value("AVAILABLELANGUAGES"),
					"module:Xmlnuke.Admin.ManageDBConn",
					array($buttons),
					$anydatafile
				);

			$block->addXmlnukeObject($crud);

			$p = new XmlParagraphCollection();
			$p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("NOTE"), true));
			$p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("PHPNOTE")));
			$block->addXmlnukeObject($p);
		}
		else
		{
			$p = new XmlParagraphCollection();
			$db = $this->_context->get("valueid");
			if ($db == "")
			{
				$p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ERRORDBEMPTY")));
			}
			else
			{
				try
				{
					$dbdataset = new DBDataset($db);
					$dbdataset->TestConnection();
					$p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("SEEMSOK")));
				}
				catch (Exception $ex)
				{
					$p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GOTERROR", $ex->getMessage())));
				}
			}
			$block->addXmlnukeObject($p);
			$p = new XmlParagraphCollection();
			$href = new XmlAnchorCollection("module:Xmlnuke.Admin.ManageDBConn");
			$href->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GOBACK")));
			$p->addXmlnukeObject($href);
			$block->addXmlnukeObject($p);
		}

		$this->defaultXmlnukeDocument->addXmlnukeObject($block);
		return $this->defaultXmlnukeDocument->generatePage();
	}