Setup the form.

@param  \Illuminate\Support\Fluent $model
@param  \Orchestra\Contracts\Html\Form\Builder  $form

@return void
193777
protected function form(Fluent $model, FormBuilder $form)
    {
        $form->extend(function (FormGrid $form) {
            $form->fieldset('Role Configuration', function (Fieldset $fieldset) {
                $roles = Role::pluck('name', 'id');

                $fieldset->control('select', 'admin_role')
                    ->label(trans('orchestra/control::label.roles.admin'))
                    ->options($roles);

                $fieldset->control('select', 'member_role')
                    ->label(trans('orchestra/control::label.roles.member'))
                    ->options($roles);
            });

            $form->fieldset('Timezone', function (Fieldset $fieldset) {
                $agreement = ['yes' => 'Yes', 'no' => 'No'];

                $fieldset->control('select', 'localtime')
                    ->attributes(['role' => 'agreement'])
                    ->label(trans('orchestra/control::label.enable-timezone'))
                    ->options($agreement)
                    ->value(function ($row) {
                        return ($row->localtime === true) ? 'yes' : 'no';
                    });
            });
        });
    }
33604
public function apply(Builder $builder, Model $model)
    {
        $column = $model->getQualifiedActiveColumn();

        $builder->where($column, true);

        $this->addWithInactive($builder);
    }
111531
public function form(Form $form)
    {
        if ($this->mode == self::MODE_INLINE || $this->mode == self::MODE_INLINE_NO_LABELS) {
            $form->addClass('form-inline');
        } elseif ($this->mode == self::MODE_HORIZONTAL) {
            $form->addClass('form-horizontal');
        }

        return parent::form($form);
    }
244458
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            '__tab_main',
            TabType::class,
            [
                'label' => 'admin.user.tab.main.label',
                'inherit_data' => true,
            ]
        );
        /** @var FormBuilderInterface $mainTab */
        $mainTab = $builder->get('__tab_main');
        $mainTab
            ->add(
                'username',
                TextType::class,
                [
                    'label' => 'admin.user.form.username.label',
                ]
            )
            ->add(
                'email',
                EmailType::class,
                [
                    'label' => 'admin.user.form.email.label',
                ]
            );

        if ($this->getUser() && $this->authorizationChecker->isGranted('ROLE_ADMIN', $this->getUser())) {
            $mainTab
                ->add(
                    'enabled',
                    SwitchType::class,
                    [
                        'label' => 'admin.user.form.enabled.label',
                    ]
                )
                ->add(
                    'rawRoles',
                    RoleHierarchyType::class,
                    [
                        'label' => 'admin.user.form.roles.label',
                    ]
                )
                ->add(
                    'familyPermissions',
                    BootstrapCollectionType::class,
                    [
                        'label' => 'admin.user.form.familyPermissions.label',
                        'entry_type' => FamilyPermissionType::class,
                        'entry_options' => [],
                        'allow_add' => true,
                        'allow_delete' => true,
                        'required' => false,
                        'sortable' => false,
                        'by_reference' => false,
                    ]
                );

            $builder->add(
                '__tab_groups',
                TabType::class,
                [
                    'label' => 'admin.user.tab.groups.label',
                    'inherit_data' => true,
                ]
            );
            /** @var FormBuilderInterface $groupsTab */
            $groupsTab = $builder->get('__tab_groups');
            $groupsTab
                ->add(
                    'groups',
                    EntityType::class,
                    [
                        'label' => 'admin.user.form.groups.label',
                        'class' => Group::class,
                        'expanded' => true,
                        'multiple' => true,
                    ]
                );
        }

        $builder->add(
            '__tab_info',
            TabType::class,
            [
                'label' => 'admin.user.tab.info.label',
                'inherit_data' => true,
            ]
        );
        // Add EAV data edition
        $this->buildDataForm($builder);

        $builder->addEventListener(
            FormEvents::POST_SUBMIT,
            function (FormEvent $event) {
                /** @var User $user */
                $user = $event->getData();
                if ($user) {
                    $user->setUpdatedAt(new \DateTime());
                }
            }
        );
    }
521413
public function addForm(FormObject $form)
    {
        if (true === $this->hasForm($form->getClassName(), $form->getName())) {
            throw DuplicateEntryException::formWasAlreadyRegistered($form);
        }

        $form->getConfiguration()->setParents([$this]);

        $this->forms[$form->getClassName()][$form->getName()] = $form;
    }
991564
protected function loadForm()
    {
        if (! $this->_form) {
            $options = array();

            if (\MUtil_Bootstrap::enabled()) {
                //$options['class'] = 'form-horizontal';
                $options['role'] = 'form';
            }

            $this->_form = $this->createForm($options);

            $this->addFormElements($this->_form);
        }
    }
297666
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($options['plugin'] !== $this->plugin) {
            return;
        }

        $this->buildPluginForm($builder, $options);
    }
1273279
protected function addFormElements(\Zend_Form $form)
    {
        $this->saveLabel = $this->_('Save Two Factor Setup');

        $this->authenticator->addSetupFormElements($form, $this->user, $this->formData);

        if ($this->user->canSaveTwoFactorKey()) {
            $options = [
                'label' => $this->_('Enabled'),
                ];

            $keyElement = $form->createElement('Checkbox', 'twoFactorEnabled', $options);
            $form->addElement($keyElement);
        }
    }
463623
public function addForm(BaseForm $form)
    {
        $formErrorInformation = $this->getSession()->getFormErrorInformation();

        // Get form field error details
        $formFieldErrors = [];

        /** @var Form $field */
        foreach ($form->getForm()->getIterator() as $field) {
            $errors = $field->getErrors();

            if (\count($errors) > 0) {
                $formFieldErrors[$field->getName()] = [];

                /** @var FormError $error */
                foreach ($errors as $error) {
                    $formFieldErrors[$field->getName()][] = [
                        'message' => $error->getMessage(),
                        'template' => $error->getMessageTemplate(),
                        'parameters' => $error->getMessageParameters(),
                        'pluralization' => $error->getMessagePluralization()
                    ];
                }
            }
        }

        $this->set(\get_class($form) . ":" . $form->getType(), $form);

        // Set form error information
        $formErrorInformation[\get_class($form) . ":" . $form->getType()] = [
            'data'              => $this->cleanFormData($form->getForm()->getData()),
            'hasError'          => $form->hasError(),
            'errorMessage'      => $form->getErrorMessage(),
            'method'            => $this->requestStack->getCurrentRequest()->getMethod(),
            'timestamp'         => time(),
            'validation_groups' => $form->getForm()->getConfig()->getOption('validation_groups'),
            'field_errors'      => $formFieldErrors
        ];

        $this->getSession()->setFormErrorInformation($formErrorInformation);

        return $this;
    }
654394
public function updateEditForm($form)
    {
        if ($doadd = Config::inst()->get('ModelAdmin', 'addbetterimporters')) {
            $modelclass = $this->owner->modelClass;
            $grid = $form->Fields()->fieldByName($modelclass);
            $config =  $grid->getConfig();

            //don't proceed if there is already an importer
            if ($config->getComponentByType("GridFieldImporter")) {
                return;
            }
            //don't proceed if can't create
            if (!singleton($modelclass)->canCreate(Member::currentUser())) {
                return;
            }
            //allow config to avoid adding when there are existing importers
            $importerClasses = $this->owner->stat('model_importers');
            if (
                $doadd === "scaffolded" &&
                !is_null($importerClasses) &&
                isset($importerClasses[$modelclass])
            ) {
                return;
            }
            
            //add the component
            $config->addComponent(new GridFieldImporter('before'));
        }
    }
875733
public function apply(Builder $builder, Eloquent $model)
    {
        $builder->where('post_type', strtolower(snake_case(class_basename($model))));
    }
1277855
protected function InitForm()
    {
        $this->submit = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
936054
protected function application(FormGrid $form)
    {
        $form->fieldset(trans('orchestra/foundation::label.settings.application'), function (Fieldset $fieldset) {
            $fieldset->control('input:text', 'site_name')
                ->label(trans('orchestra/foundation::label.name'));

            $fieldset->control('textarea', 'site_description')
                ->label(trans('orchestra/foundation::label.description'))
                ->attributes(['rows' => 3]);

            $fieldset->control('select', 'site_registrable')
                ->label(trans('orchestra/foundation::label.settings.user-registration'))
                ->attributes(['role' => 'agreement'])
                ->options([
                    'yes' => 'Yes',
                    'no' => 'No',
                ]);
        });
    }
1012927
public function setupForm(&$mform) {
        $obj =& $mform->addElement('select', $this->_name, $this->_label, $this->get_roles());
        $mform->setDefault($this->_name, 0);
        if ($this->_advanced) {
            $mform->setAdvanced($this->_name);
        }
    }
280151
public function buildForm()
    {

        $this
            ->add($this->model->getKeyName(), 'hidden')
            ->add('email', 'email',
                [
                    'label'      => trans('expendable::form.email'),
                    'validation' => 'required,custom[email]',
                ]);

        $id = $this->model->getKey();

        if (!empty($id))
        {
            $this->add('change_password', 'checkbox', [
                'default_value' => 1,
                'label'         => trans('expendable::form.change_password_help'),
                'checked'       => false,
                'noInEditView'  => true
            ]);
        }

        $this->add('password', 'password',
            [
                'label'        => trans('expendable::form.password'),
                'attr'         => ['id' => 'password'],
                'validation'   => 'required',
                'noInEditView' => true
            ])
            ->add('password_match', 'password',
                [
                    'label'        => trans('expendable::form.repeat_password'),
                    'validation'   => 'required,equals[password]',
                    'noInEditView' => true
                ])
            ->add('status', 'choice', [
                'choices'     => StaticLabel::status(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.status')
            ])
            ->add('role_id', 'choice', [
                'choices'     => Role::getChoice(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.role')
            ])
            ->addDefaultActions();
    }
87766
public static function populateForm(Form $form)
	{
		if (static::$builder === null)
		{
			static::setBuilder(new V1Model);

			static::$builder->setWrapperElement(null);
		}

		$elements = static::$builder->generate(get_called_class());

		return $form->setContents($elements);
	}
1275661
public function setup(Model $Model, $config = array()) {
		if (is_string($config)) {
			$config = array($config);
		}

		$_config = array();

		foreach ((array) $config as $field => $options) {
			if (is_int($field) && is_string($options)) {
				$field = $options;
				$options = $this->_options;
			}
			$_config[$field] = array_merge($this->_options, $options);
		}

		$this->settings[$Model->alias] = $_config;
	}