Displays a form to create a new Center entity.
172930
public function newAction()
    {
        $center = new Center();
        $form   = $this->createCreateForm($center);

        return $this->render('ChillMainBundle:Center:new.html.twig', array(
            'entity' => $center,
            'form'   => $form->createView(),
        ));
    }
1213853
def add_entity(self,entity):
        
        if self.entity_layer is None:
            self.entity_layer = Centities(type=self.type)
            self.root.append(self.entity_layer.get_node())
        self.entity_layer.add_entity(entity)
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);
  }
1277479
public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#attributes']['class'][] = 'card card__block form--default form-wrapper form-group';

    if (empty($nid)) {
      $node = \Drupal::routeMatch()->getParameter('node');
      if ($node instanceof NodeInterface) {
        // You can get nid and anything else you need from the node object.
        $nid = $node->id();
      }
      elseif (!is_object($node)) {
        $nid = $node;
      }
    }

    // Load the current Event enrollments so we can check duplicates.
    $storage = \Drupal::entityTypeManager()->getStorage('event_enrollment');
    $enrollments = $storage->loadByProperties(['field_event' => $nid]);

    $enrollmentIds = [];
    foreach ($enrollments as $enrollment) {
      $enrollmentIds[] = $enrollment->getAccount();
    }

    $form['name'] = [
      '#type' => 'social_enrollment_entity_autocomplete',
      '#selection_handler' => 'social',
      '#selection_settings' => [
        'skip_entity' => $enrollmentIds,
      ],
      '#target_type' => 'user',
      '#tags' => TRUE,
      '#description' => $this->t('To add multiple members, separate each member with a comma ( , ).'),
      '#title' => $this->t('Select members to add'),
    ];

    $form['actions']['cancel'] = [
      '#type' => 'link',
      '#title' => t('Cancel'),
      '#url' => Url::fromRoute('view.event_manage_enrollments.page_manage_enrollments', ['node' => $nid]),
    ];

    $form['actions']['submit'] = [
      '#prefix' => '<div class="form-actions">',
      '#suffix' => '</div>',
      '#type' => 'submit',
      '#value' => $this->t('Save'),
      '#button_type' => 'primary',
    ];

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

    return $form;
  }
390210
def register_new(self, entity_class, entity):
        
        EntityState.manage(entity, self)
        EntityState.get_state(entity).status = ENTITY_STATUS.NEW
        self.__entity_set_map[entity_class].add(entity)
385235
public function newAction()
    {
        $entity = new Category();
        $form   = $this->createForm(new CategoryType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
795372
public function AddForm() {
		$classes = ClassInfo::subclassesFor(self::$tree_class);
		array_shift($classes);

		foreach ($classes as $key => $class) {
			if (!singleton($class)->canCreate())
				unset($classes[$key]);
			$classes[$key] = FormField::name_to_label($class);
		}

		$fields = new FieldList(
			new HiddenField("ParentID"),
			new HiddenField("Locale", 'Locale', i18n::get_locale()),
			$type = new DropdownField("ProviderType", "", $classes)
		);
		$type->setAttribute('style', 'width:150px');

		$actions = new FieldList(
			FormAction::create("addprovider", _t('ExternalContent.CREATE', "Create"))
				->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')
				->setUseButtonTag(true)
		);

		$form = new Form($this, "AddForm", $fields, $actions);

		$form->addExtraClass('cms-edit-form ' . $this->BaseCSSClasses());
		$this->extend('updateEditForm', $form);

		return $form;
	}
1430
public function newAction()
    {
        $entity = new Page();
        $form   = $this->createForm(new PageType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
557666
def create_entity(self):
        """"""
        self._highest_id_seen += 1
        entity = Entity(self._highest_id_seen, self)
        self._entities.append(entity)
        return entity
482416
public void renderEntityForm(String entityId, List<CmsTabInfo> tabInfos, Panel context, Element scrollParent) {

        CmsEntity entity = m_entityBackend.getEntity(entityId);
        if (entity != null) {
            boolean initUndo = (m_entity == null) || !entity.getId().equals(m_entity.getId());
            m_entity = entity;
            CmsType type = m_entityBackend.getType(m_entity.getTypeName());
            m_formPanel = new FlowPanel();
            context.add(m_formPanel);
            CmsAttributeHandler.setScrollElement(scrollParent);
            CmsButtonBarHandler.INSTANCE.setWidgetService(m_widgetService);
            if (m_rootHandler == null) {
                m_rootHandler = new CmsRootHandler();
            } else {
                m_rootHandler.clearHandlers();
            }
            m_tabInfos = tabInfos;
            m_formTabs = m_widgetService.getRendererForType(
                type).renderForm(m_entity, m_tabInfos, m_formPanel, m_rootHandler, 0);
            m_validationHandler.registerEntity(m_entity);
            m_validationHandler.setRootHandler(m_rootHandler);
            m_validationHandler.setFormTabPanel(m_formTabs);
            if (initUndo) {
                CmsUndoRedoHandler.getInstance().initialize(m_entity, this, m_rootHandler);
            }
            // trigger validation right away
            m_validationHandler.validate(m_entity);
        }
    }
444605
public function create()
    {
	    $formContainer = new Extension();
	    $myForm = $formContainer->getForm();

	    if ($myForm->isValid() && $myForm->isSubmited()) {
	        $creator = new ExtensionCreator(
	            $myForm->getValue('name'),
	            $myForm->getValue('label'),
	            $myForm->getValue('version'),
	            $myForm->getValue('author'),
	            $myForm->getValue('authorNs'),
	            $myForm->getValue('license'),
	            $myForm->getValue('description'),
	            $myForm->getValue('dependencies'),
	            $myForm->getValue('samples')
            );
	        $report = $creator->run();
	        $this->setData('myForm', __('Extension created'));
	    } else {
	        $this->setData('myForm', $myForm->render());
	    }

	    $this->setData('formTitle', __('Create a new Extension'));
	    $this->setView('form.tpl', 'tao');
	}
255526
protected function createComponentConfigurationForm(): Form
	{
		$form = $this->formFactory->create();
		$form->setAjaxRequest();

		$form->addGroup('cms.settings.basic');
		$form->addImageUpload('cmsLogo', 'cms.settings.logo', 'cms.settings.deleteLogo')
			->setNamespace('cms')
			->setPreview('300x100');
		$form->addCheckbox('sendNewUserPassword', 'cms.settings.sendNewUserPassword');
		$form->addCheckbox('sendChangePassword', 'cms.settings.sendChangePassword');
		$form->addCheckbox('dockbarAdvanced', 'cms.settings.dockbarAdvanced');
		$form->addSelectUntranslated('defaultLocale', 'cms.settings.defaultLocale', $this->localeService->fetch())
			->setDefaultValue($this->localeService->defaultLocaleId);
		$form->addMultiSelectUntranslated('allowedLocales', 'cms.settings.allowedLocales', $this->localeService->fetch())
			->setDefaultValue($this->localeService->allowedLocaleIds)
			->setRequired();

		$form->addGroup('cms.settings.development');
		if (!$this->tracy->isEnabled()) {
			$form->addLink('debugOn', 'cms.settings.debugOn')
				->link($this->link('debug!', true))
				->setAjaxRequest()
				->addClass('btn-success')
				->setAttribute('data-ajax-off', 'history');
		} else {
			$form->addLink('debugOff', 'cms.settings.debugOff')
				->link($this->link('debug!', false))
				->setAjaxRequest()
				->addClass('btn-danger')
				->setAttribute('data-ajax-off', 'history');
		}
		$form->addCheckbox('mailPanel', 'cms.settings.mailPanel')
			->setDefaultValue($this->configurator->mailPanel);

		$form->getRenderer()->primaryButton = $form->addSubmit('save', 'form.save');

		$form->onSuccess[] = [$this, 'configurationFormSucseeded'];

		return $form;
	}
724764
private function createCreateForm(RegistrationRole $entity)
    {
        $form = $this->createForm('sam_create_role', $entity, array(
            'action' => $this->generateUrl('sam_role_create'),
            'method' => 'POST'
        ));

        return $form;
    }
128046
protected function createComponentEditForm(): Form
	{
		$form = new Form;
		$form->setAjaxRequest();

		$form->addHidden('id');

		$form->addTextArea('content')
			->setAttribute('autofocus', true);

		$form->addSubmit('save', $this->translator->translate('nattreid.fileManager.save'));

		$form->onSuccess[] = [$this, 'editFormSucceeded'];

		return $form;
	}
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");
}
600918
def create_form(*fields)
            acroform = self.Catalog.AcroForm ||= InteractiveForm.new.set_indirect(true)
            self.add_fields(*fields)

            acroform
        end
134979
def new():
    """"""
    form = CommunityForm(formdata=request.values)

    ctx = mycommunities_ctx()
    ctx.update({
        'form': form,
        'is_new': True,
        'community': None,
    })

    if form.validate_on_submit():
        data = copy.deepcopy(form.data)

        community_id = data.pop('identifier')
        del data['logo']

        community = Community.create(
            community_id, current_user.get_id(), **data)

        file = request.files.get('logo', None)
        if file:
            if not community.save_logo(file.stream, file.filename):
                form.logo.errors.append(_(
                    'Cannot add this file as a logo. Supported formats: '
                    'PNG, JPG and SVG. Max file size: 1.5 MB.'))
                db.session.rollback()
                community = None

        if community:
            db.session.commit()
            flash("Community was successfully created.", category='success')
            return redirect(url_for('.edit', community_id=community.id))

    return render_template(
        current_app.config['COMMUNITIES_NEW_TEMPLATE'],
        community_form=form,
        **ctx
    )