Build create.blade.php form
516679
private function buildCreateForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $key   = $field->title;
            if (in_array($field->validation, $this->starred)) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $key = $field->relationship_name . '_id';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                $key,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', ' . $field->value : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsCreate = $form;
    }
31018
public function buildForm()
    {

        $this
            ->add('range', 'datepicker',
                [
                    'label'      => trans('expendable::form.date'),
                    'validation' => 'required',
                    'range'      => true
                ])
            ->add('type', 'choice', [
                'choices'    => StaticLabel::typeExport(),
                'validation' => 'required',
                'label'      => trans('expendable::form.type')
            ])
            ->addDefaultActions();
    }
566080
public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#attributes']['class'][] = 'form--default';
    $form['group_settings'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('Settings'),
    ];
    $form['group_settings']['group_type'] = $this->getGroupTypeElement();
    $form['actions']['submit'] = [
      '#prefix' => '<div class="form-actions">',
      '#suffix' => '</div>',
      '#type' => 'submit',
      '#value' => $this->t('Continue'),
      '#button_type' => 'primary',
    ];

    $form['#cache']['contexts'][] = 'user';

    return $form;
  }
65835
@RequestMapping(value = "builds/{buildId}/links", method = RequestMethod.PUT)
    public Build createBuildLinkFromForm(@PathVariable ID buildId, @RequestBody BuildLinkForm form) {
        Build build = structureService.getBuild(buildId);
        structureService.editBuildLinks(build, form);
        return build;
    }
1345867
public function generateRequest()
    {
        if (!$this->confirm('Do you want to create form request classes?')) {
            return;
        }

        foreach (['Create', 'Update'] as $request) {
            $name = $this->getPrefix('/').$this->getEntities().'/'.$request.Str::studly($this->getEntity()).'Request';

            $this->console->call('generate:request', [
                'name' => $name,
                '--scaffold' => true,
                '--auth' => true,
                '--rules' => $this->existing() ? $this->getTableDumper()->toSchema() : $this->getFields(),
                '--force' => $this->console->option('force'),
            ]);
        }
    }
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);
	}
267566
public function buildForm(array $form, FormStateInterface $form_state, $sid = NULL) {
    $this->sid = (int) $sid;
    if ($this->sid) {
      $slide = $this->databaseSliders->loadSlide($sid);
      $this->slide = $slide;      
    }
    return parent::buildForm($form, $form_state);
  }
565929
function form () {
  form.form = $("#swagger-parser-form");

  form.allow = {
    label: form.form.find("#allow-label"),
    menu: form.form.find("#allow-menu"),
    json: form.form.find("input[name=allow-json]"),
    yaml: form.form.find("input[name=allow-yaml]"),
    text: form.form.find("input[name=allow-text]"),
    empty: form.form.find("input[name=allow-empty]"),
    unknown: form.form.find("input[name=allow-unknown]")
  };

  form.refs = {
    label: form.form.find("#refs-label"),
    menu: form.form.find("#refs-menu"),
    external: form.form.find("input[name=refs-external]"),
    circular: form.form.find("input[name=refs-circular]")
  };

  form.validate = {
    label: form.form.find("#validate-label"),
    menu: form.form.find("#validate-menu"),
    schema: form.form.find("input[name=validate-schema]"),
    spec: form.form.find("input[name=validate-spec]")
  };

  form.tabs = {
    url: form.form.find("#url-tab"),
    text: form.form.find("#text-tab")
  };

  form.method = {
    button: form.form.find("button[name=method]"),
    menu: form.form.find("#method-menu")
  };

  form.samples = {
    url: {
      container: form.form.find("#url-sample"),
      link: form.form.find("#url-sample-link"),
    },
    text: {
      container: form.form.find("#text-sample"),
      link: form.form.find("#text-sample-link"),
    }
  };

  form.url = form.form.find("input[name=url]");
  form.textBox = null; // This is set in editors.js
  form.bookmark = form.form.find("#bookmark");
}
1095664
public function createAction()
    {
        $this->assertIsGranted('ROLE_WS_CREATOR');
        $user = $this->tokenStorage->getToken()->getUser();
        $form = $this->formFactory->create(FormFactory::TYPE_WORKSPACE, array($user));
        $form->handleRequest($this->request);
        $ds = DIRECTORY_SEPARATOR;
        $modelLog = $this->container->getParameter('kernel.root_dir') . '/logs/models.log';
        $logger = FileLogger::get($modelLog);
        $this->workspaceManager->setLogger($logger);

        if ($form->isValid()) {
            $model = $form->get('model')->getData();

            if (!is_null($model)) {
                $this->createWorkspaceFromModel($model, $form);
            } else {
                $config = Configuration::fromTemplate(
                    $this->templateDir . $ds . 'default.zip'
                );
                $config->setWorkspaceName($form->get('name')->getData());
                $config->setWorkspaceCode($form->get('code')->getData());
                $config->setDisplayable($form->get('displayable')->getData());
                $config->setSelfRegistration($form->get('selfRegistration')->getData());
                $config->setRegistrationValidation($form->get('registrationValidation')->getData());
                $config->setSelfUnregistration($form->get('selfUnregistration')->getData());
                $config->setWorkspaceDescription($form->get('description')->getData());

                $user = $this->tokenStorage->getToken()->getUser();
                $this->workspaceManager->create($config, $user);
            }
            $this->tokenUpdater->update($this->tokenStorage->getToken());
            $route = $this->router->generate('claro_workspace_by_user');

            $msg = $this->get('translator')->trans(
                'successfull_workspace_creation',
                array('%name%' => $form->get('name')->getData()),
                'platform'
            );
            $this->get('request')->getSession()->getFlashBag()->add('success', $msg);

            return new RedirectResponse($route);
        }

        return array('form' => $form->createView());
    }
607355
private function generateForm()
    {
        // Generate Form Component class
        $controllerInstance = Controller::instance($this->columns, null, $this);

        $formTemplateDir =
            dirname(dirname(__FILE__)).DS.'src'.DS.'Apps'.DS.'Form'.DS;

        $form = new Form($controllerInstance, $this);
        $form->setFormTemplatePath($formTemplateDir);

        $form->generate();
    }
1256865
public function build()
    {
        // load filter
        // 1. App/Controller/filter.yml
        // 2. App/Controller/foo.filter.yml
        $filters = $this->controller->getFilters();
        for ($i = 0; $i < count($filters); $i++) {
            $this->loadFilter($filters[$i], $i !== count($filters) - 1);
        }

        // action filter is already last.
        if (! $this->has_action_filter) {
            $this->addFilter('Action');
        } else {
            $action = null;
            $names = array();
            foreach ($this->filter_names as $name) {
                if (strtolower($name) === 'action') {
                    $action = $name;
                } else {
                    $names[] = $name;
                }
            }
            $names[] = $action;
            $this->filter_names = $names;
        }
    }
1114045
public function createAction()
    {
        $form = $this->createForm();
        $submit = new Submit();
        $lng = \Cmf\Language\Factory::get($this);
        $submit->setValue($lng['create']);
        $form->setElement($submit);

        $response = [
            'form' => $form,
            'actionLinks' => ActionLinkFactory::createLinks($this->getActionLinkConfig()),
        ];

        if ($form->isSubmitted()) {
            $form->getValuesFromRequest();
            if ($form->validate()) {
                $entity = new $this->entityName();
                $this->fillEntityFromForm($entity, $form);
                $this->fillEntityForCreate($entity);

                try {
                    $em = $this->getEntityManager();
                    $em->persist($entity);
                    $em->flush();
                    $result = true;
                } catch (\Exception $e) {
                    $lng = \Cmf\Language\Factory::get($this);
                    $form->getMessages()->setItem(new Message($lng[self::ERR_DB]));
                    $result = false;
                }
                if ($result) {
                    $response = new PostRedirectGet($this);
                    $response->setRedirectPath([
                        'module' => $this->request->getModuleName(),
                        'controller' => $this->getControllerName(),
                        'action' => 'creationOk',
                    ]);
                }
            }
        }

        return $response;
    }
166674
public function build()
    {
        $view = new View\AtomicKitten;
        $resultFile = new SplFileObject($this->buildSettings['target'] . 'index.html', 'w');
        $resultFile->fwrite($view->render('Generator/Index'));
    }
871151
public function createAction()
    {
        $success = null;
        $this->paragraphLayout();

        /* @var $form \Zend\Form\Form */
        $request    = $this->getRequest();
        $data       = $request->getPost();
        $service    = $this->getServiceLocator();
        $model      = $service->get( 'Grid\User\Model\User\Model' );
        $form       = $service->get( 'Form' )
                              ->get( 'Grid\User\PasswordChangeRequest\Create' );

        if ( $request->isPost() )
        {
            $form->setData( $data );

            if ( $form->isValid() )
            {
                $data = $form->getData( 'email' );
                $user = $model->findByEmail( $data['email'] );

                if ( ! empty( $user ) &&
                     $user->state != UserStructure::STATE_BANNED )
                {
                    $change = $this->url()
                                   ->fromRoute( 'Grid\User\PasswordChangeRequest\Resolve', array(
                                       'locale' => (string) $this->locale(),
                                       'hash'   => $this->getServiceLocator()
                                                        ->get( 'Grid\User\Model\ConfirmHash' )
                                                        ->create( $user->email ),
                                   ) );

                    $this->getServiceLocator()
                         ->get( 'Grid\Mail\Model\Template\Sender' )
                         ->prepare( array(
                             'template' => 'user.forgotten-password',
                             'locale'   => $user->locale,
                         ) )
                         ->send( array(
                             'email'        => $user->email,
                             'display_name' => $user->displayName,
                             'change_url'   => $change,
                         ), array(
                             $user->email   => $user->displayName,
                         ) );

                    $success = true;
                }
                else
                {
                    $success = false;
                }
            }
            else
            {
                $success = false;
            }
        }

        /* Says success even if email does not exists */
        if ( $success === true || $success === false )
        {
            $this->messenger()
                 ->add( 'user.form.passwordRequest.success',
                        'user', Message::LEVEL_INFO );
        }

        return new MetaContent( 'user.passwordChangeRequest', array(
            'form' => $form,
        ) );
    }
1260874
protected function registerBlade()
    {
        $this->app->afterResolving('blade.compiler', function (BladeCompiler $blade) {
            $blade->directive('app_version', function () {
                return "<?php echo resolve('" . AppVersionManagerContract::class . "')->formatted(); ?>";
            });

            $blade->directive('app_build', function () {
                return "<?php echo resolve('" . AppVersionManagerContract::class . "')->build(); ?>";
            });

            $blade->directive('app_version_hash', function ($length = 6) {
                return "<?php echo resolve('" . AppVersionManagerContract::class . "')->hashed({$length}); ?>";
            });
        });
    }
962635
private function buildEditForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $label = $field->title;
            if (in_array($field->validation,
                    $this->starred) && $field->type != 'password' && $field->type != 'file' && $field->type != 'photo'
            ) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $label = $field->relationship_name . '_id';
            }
            if ($field->type == 'checkbox') {
                $field->default = '$' . $this->model . '->' . $label . ' == 1';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                'old(\'$LABEL$\')',
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                'old(\'$LABEL$\',$' . $this->resource . '->' . $label . ')',
                $label,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', "' . $field->value . '"' : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsEdit = $form;
    }
485275
protected function buildForm(FormDefinition $formDefinition)
    {
        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Configure database');

        $introduction = $page1->createElement('introduction', 'Neos.Form:StaticText');
        $introduction->setProperty('text', 'Please enter database details below:');

        $connectionSection = $page1->createElement('connectionSection', 'Neos.Form:Section');
        $connectionSection->setLabel('Connection');

        $databaseDriver = $connectionSection->createElement('driver', 'Neos.Form:SingleSelectDropdown');
        $databaseDriver->setLabel('DB Driver');
        $databaseDriver->setProperty('options', $this->getAvailableDrivers());
        $databaseDriver->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.driver'));
        $databaseDriver->addValidator(new NotEmptyValidator());

        $databaseUser = $connectionSection->createElement('user', 'Neos.Form:SingleLineText');
        $databaseUser->setLabel('DB Username');
        $databaseUser->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.user'));
        $databaseUser->addValidator(new NotEmptyValidator());

        $databasePassword = $connectionSection->createElement('password', 'Neos.Form:Password');
        $databasePassword->setLabel('DB Password');
        $databasePassword->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.password'));

        $databaseHost = $connectionSection->createElement('host', 'Neos.Form:SingleLineText');
        $databaseHost->setLabel('DB Host');
        $defaultHost = Arrays::getValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.host');
        if ($defaultHost === null) {
            $defaultHost = '127.0.0.1';
        }
        $databaseHost->setDefaultValue($defaultHost);
        $databaseHost->addValidator(new NotEmptyValidator());

        $databaseSection = $page1->createElement('databaseSection', 'Neos.Form:Section');
        $databaseSection->setLabel('Database');

        $databaseName = $databaseSection->createElement('dbname', 'Neos.Setup:DatabaseSelector');
        $databaseName->setLabel('DB Name');
        $databaseName->setProperty('driverDropdownFieldId', $databaseDriver->getUniqueIdentifier());
        $databaseName->setProperty('userFieldId', $databaseUser->getUniqueIdentifier());
        $databaseName->setProperty('passwordFieldId', $databasePassword->getUniqueIdentifier());
        $databaseName->setProperty('hostFieldId', $databaseHost->getUniqueIdentifier());
        $databaseName->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.dbname'));
        $databaseName->addValidator(new NotEmptyValidator());
    }