Displays a form to create a new Page entity.

@Route("/new", name="manage_page_new")
@Template()
1430
public function newAction()
    {
        $entity = new Page();
        $form   = $this->createForm(new PageType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
47577
public function CreatePageForm() {
		$createOptions = array(
			'child' => 'As a child of the selected page',
			'sibling' => 'As a sibling of the selected page',
		);

		$pageTree = new TreeDropdownField('CreateContext', _t('WikiPage.CREATE_CONTEXT', 'Select an existing page'), 'WikiPage');
		$pageTree->setValue($this->ID);
		$pageTree->setTreeBaseID($this->data()->getWikiRoot()->ID);
		$fields = FieldList::create(
						new TextField('NewPageName', _t('WikiPage.NEW_PAGE_NAME', 'New Page Name')),
						$pageTree,
						new OptionsetField('CreateType', _t('WikiPage.CREATE_OPTIONS', 'and create the new page '), $createOptions, 'child')
		);

		$actions = FieldList::create(new FormAction('addpage', _t('WikiPage.ADD_PAGE', 'Create')));

		return new Form($this, 'CreatePageForm', $fields, $actions);
	}
726637
public function newAction()
    {
        $model = $this->loadModel();
        if (!$model->isObjectNew()) {
            $this->_forward('noroute');
            return;
        }

        if ($this->getRequest()->isPost()) {
            $postData = $this->getRequest()->getPost();
            try {
                $model->isObjectNew(true);
                foreach ($this->preprocessPostData($postData) as $key => $value) {
                    $model->setDataUsingMethod($key, $value);
                }
                $model->save();
                $this->_redirectUrl($this->getHelper()->getGridUrl());
                $this->_getSession()->addSuccess('Saved Successfully');
                return;
            } catch (Exception $e) {
                $message = $e->getMessage();
                if ($e instanceof Zend_Db_Statement_Exception && $e->getChainedException() instanceof PDOException) {
                    /** @var PDOException $e */
                    $e = $e->getChainedException();
                    if (isset($e->errorInfo[0]) && $e->errorInfo[0] == 23000 && isset($e->errorInfo[1]) && $e->errorInfo[1] == 1062) {
                        $message = $this->getHelper()->__(
                            "Record already exists for %s '%s'",
                            $model->getIdFieldName(),
                            $model->getId()
                        );
                    }
                }
                Mage::logException($e);
                $this->_getSession()->addError($message);
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
912616
public function newAction(Request $request)
    {
        /** @var ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_CREATE);

        /** @var PluginConfigurator $pluginConfigurator */
        $pluginConfigurator = $configuratorFactory->getConfigurator(PluginConfigurator::class);
        $template = $pluginConfigurator->isBulkInsertEnabled() ? $crudConfigurator->getTemplate()->getBulkCreate() : $crudConfigurator->getTemplate()->getCreate();

        $modelClass = $crudConfigurator->getCrud()->getModelClass();
        $model = new $modelClass();
        $form = $crudConfigurator->getForm($model);

        return $this->createOrUpdate($request, $model, $form, Constants::ACTION_CREATE, $template);
    }
1029830
public function newAction()
    {
        $this->isAllowed('BUSINESS_MANAGE_ROLE');

        $entity = new RegistrationRole();
        $form   = $this->createCreateForm($entity);
        return $this->render('CanalTPSamEcoreSecurityBundle:Role:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }
1347706
public function newAction()
    {
        $entity = new Brand();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
1069656
public function createAction()
	{
		$this->isPostRequest();

		$page = new GroupPage();

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

		$localization = Localization::factory($page, $localeId);
		/* @var $localization \Supra\Package\Cms\Entity\GroupLocalization */

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

		if (empty($title)) {
			throw new CmsException(null, 'Group title cannot be empty.');
		}

		$localization->setTitle($title);

		$parentLocalizationId = $this->getRequestParameter('parent_id');

		if (empty($parentLocalizationId)) {
			throw new \UnexpectedValueException(
					'Parent ID is empty while it is not allowed Group to be root.'
			);
		}

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

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

		$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));
	}
856662
public function create(PageRequest $request)
    {

        $page = $this->repository->newInstance([]);
        return $this->response->setMetaTitle(trans('app.new') . ' ' . trans('page::page.name')) 
            ->view('page::page.create', true) 
            ->data(compact('page'))
            ->output();
    }
214425
public function create()
    {
        // Add entry page on top level
        $newIdOfEntryPage = StringUtility::getUniqueId('NEW');
        $data = [
            'pages' => [
                $newIdOfEntryPage => [
                    'title' => 'styleguide TCA demo',
                    'pid' => 0 - $this->getUidOfLastTopLevelPage(),
                    // Mark this page as entry point
                    'tx_styleguide_containsdemo' => 'tx_styleguide',
                    // Have the "globus" icon for this page
                    'is_siteroot' => 1,
                ],
            ],
        ];

        // Add rows of third party tables like be_users and fal records
        $this->populateRowsOfThirdPartyTables();

        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $sysLanguageStyleguideDemoUids = $recordFinder->findUidsOfDemoLanguages();

        // Add a page for each main table below entry page
        $mainTables = $this->getListOfStyleguideMainTables();
        // Have the first main table inside entry page
        $neighborPage = $newIdOfEntryPage;
        foreach ($mainTables as $mainTable) {
            $newIdOfPage = StringUtility::getUniqueId('NEW');
            $data['pages'][$newIdOfPage] = [
                'title' => str_replace('_', ' ', substr($mainTable, strlen('tx_styleguide_'))),
                'tx_styleguide_containsdemo' => $mainTable,
                'hidden' => 0,
                'pid' => $neighborPage,
            ];

            if (!empty($sysLanguageStyleguideDemoUids)) {
                foreach ($sysLanguageStyleguideDemoUids as $languageUid) {
                    $newIdOfLocalizedPage = StringUtility::getUniqueId('NEW');
                    $data['pages'][$newIdOfLocalizedPage] = [
                        'title' => str_replace('_', ' ', substr($mainTable . " - language " . $languageUid, strlen('tx_styleguide_'))),
                        'tx_styleguide_containsdemo' => $mainTable,
                        'hidden' => 0,
                        'pid' => $neighborPage,
                        'sys_language_uid' => $languageUid,
                        'l10n_parent' => $newIdOfPage,
                        'l10n_source' => $newIdOfPage,
                    ];
                }
            }
            // Have next page after this page
            $neighborPage = '-' . $newIdOfPage;
        }

        // Populate page tree via DataHandler
        $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
        $dataHandler->start($data, []);
        $dataHandler->process_datamap();
        BackendUtility::setUpdateSignal('updatePageTree');

        // Create data for each main table
        foreach ($mainTables as $mainTable) {
            $generator = NULL;
            foreach ($this->tableHandler as $handlerName) {
                $generator = GeneralUtility::makeInstance($handlerName);
                if (!$generator instanceof TableHandlerInterface) {
                    throw new Exception(
                        'Table handler ' . $handlerName . ' must implement TableHandlerInterface',
                        1458302830
                    );
                }
                if ($generator->match($mainTable)) {
                    break;
                } else {
                    $generator = null;
                }
            }
            if (is_null($generator)) {
                throw new GeneratorNotFoundException(
                    'No table handler found',
                    1458302901
                );
            }
            $generator->handle($mainTable);
        }
    }
1091835
public function crudNew(Request $request = null)
    {
        try{
            $entity = $this->getEntity();
            $form   = $this->createForm($this->getEntityType(), $entity)
                           ->createView();
            
            return $this->commonsResponseVars(compact('entity','form'));
        }catch(\Exception $e){
            return $this->failure($e);
        }
    }
419140
public function newAction()
    {
        $entity = new Collection();
        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
204029
public function newAction(Request $request)
    {
        $sakonninTemplate = new Sakonnintemplate();
        $default_lang_code = $this->container->get('translator')->getLocale();
        $sakonninTemplate->setLangCode($default_lang_code);
        $form = $this->createForm('BisonLab\SakonninBundle\Form\SakonninTemplateType', $sakonninTemplate);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->persist($sakonninTemplate);
            $em->flush();

            return $this->redirectToRoute('sakonnintemplate_show', array('id' => $sakonninTemplate->getId()));
        }

        return $this->render('BisonLabSakonninBundle:SakonninTemplate:new.html.twig',
            array(
            'sakonninTemplate' => $sakonninTemplate,
            'form' => $form->createView(),
        ));
    }
609961
public function newBlockAction($page_id, $type)
    {
        $em = $this->getDoctrine()->getManager();
        $page = $em->getRepository('AmulenPageBundle:Page')->find($page_id);

        $entity = new Block();
        $entity->setType($type);
        $entity->setPage($page);
        $form = $this->createBlockCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
386603
public function createAction()
    {
        // Load form
        $entityClass = $this->getModuleNamespace() . '\Entity\\' . $this->getEntityName();
        $entity      = new $entityClass();
        $form        = $this->getForm('Create' . $this->getEntityName());
        $form->bind($entity);

        // Implement Post/Redirect/Get pattern
        $prg = $this->prg();
        if ($prg instanceof Response) {
            return $prg;
        } else if (false !== $prg) {

            // Set form data
            $form->setData($prg);

            // Create account
            $result = $this->getService()->create();
            if ($result) {
                return $this->redirect()->toRoute($this->indexRoute);
            }
        }

        // Set up view model
        $viewModel = new ViewModel(array(
            'entityName' => $this->getEntityName(),
            'form'       => $form,
        ));
        $viewModel->setTemplate('infinity-base/crud/create');

        return $viewModel;
    }
625227
public function newAction()
    {
        $entity = new Contract();
        $form   = $this->createCreateForm($entity);

        $planForm = $this->createForm(new PlanType(), new Plan(), array(
            'action' => $this->generateUrl('ecommerce_plan_new'),
            'method' => 'POST',
        ));
        
        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
            'planForm' => $planForm->createView(),
        );
    }
109738
public function newAction()
    {
        $breadcumbs = $this->container->get('bacon_breadcrumbs');

        $breadcumbs->addItem(array(
            'title' => 'Language',
            'route' => 'admin_language',
        ));

        $breadcumbs->addItem(array(
            'title' => 'New',
            'route' => '',
        ));

        $form = $this->createForm(new LanguageFormType(), new Language());

        return array(
            'form'   => $form->createView(),
        );
    }
825383
public function newAction() {

        $entity = new Role();

        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }