Gets the status form that is used by users to trigger the editing mode
if they have the relevant access to it.

@return Form
978309
public function StatusForm() {
		$existing = $this->getEditingLocks($this->data());

		if ($existing && $existing['user'] != Member::currentUser()->Email) {
			$fields = FieldList::create(
							new ReadonlyField('ExistingEditor', '', _t('WikiPage.EXISTINGEDITOR', 'This page is currently locked for editing by ' . $existing['user'] . ' until ' . $existing['expires']))
			);
			$actions = FieldList::create();
		} else {
			$fields = FieldList::create();
			$actions = FieldList::create(
							new FormAction('startediting', _t('WikiPage.STARTEDIT', 'Edit Page'))
			);
		}

		return new Form($this, 'StatusForm', $fields, $actions);
	}
1370578
public function get_statusname() {

        $status = $this->get('status');

        switch ($status) {
            case self::STATUS_DRAFT:
                $strname = 'draft';
                break;
            case self::STATUS_IN_REVIEW:
                $strname = 'inreview';
                break;
            case self::STATUS_WAITING_FOR_REVIEW:
                $strname = 'waitingforreview';
                break;
            case self::STATUS_ACTIVE:
                $strname = 'active';
                break;
            case self::STATUS_COMPLETE:
                $strname = 'complete';
                break;
            default:
                throw new \moodle_exception('errorplanstatus', 'core_competency', '', $status);
                break;
        }

        return get_string('planstatus' . $strname, 'core_competency');
    }
1069006
public function getBlockAccountForm()
    {
        if (! $this->blockAccountForm) {
            $this->setBlockAccountForm(
                $this->getServiceLocator()->get('playgrounduser_blockaccount_form')
            );
        }

        return $this->blockAccountForm;
    }
534585
public function getPostEditSecurity()
    {
        $name = $this->di->get('session')->get("user");
        $user = $this->getUserDetails($name);

        $form       = new UpdateProfileSecurityForm($this->di);
        $form->check();

        $views = [
            ["comment/user/profile/edit", ["form" => $form->getHTML(), "user" => $user], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" =>  $views,
            "title" => "Edit Profile"
        ]);
    }
700320
public function editAction()
    {
        $form = $this->getEditForm();
        $entity = $form->getObject();
        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getPost()->toArray();
            $entityManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
            $hydrator = new DoctrineHydrator($entityManager);
            $hydrator->hydrate($data, $entity);

            if ($form->isValid()) {
                $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
                $objectManager->persist($entity);
                $objectManager->flush();
                $controller = explode('/', $this->getRequest()->getUri()->getPath())[2];
                if (!$this->getRequest()->isXmlHttpRequest()) {
                    return $this->redirect()->toRoute(null, ['controller' => $controller]);
                }
                return;
            } else {
                $this->getResponse()->setStatusCode(400);
            }
        }
        $viewModel = $this->getViewModel();
        $viewModel->setTerminal($this->getRequest()->isXmlHttpRequest());

        return $viewModel->setVariables(['form' => $form]);
    }
913810
public function ItemEditForm() {
        $list=$this->gridField->getList();
        
        if(empty($this->record)) {
            $controller=$this->getToplevelController();
            $noActionURL=$controller->removeAction($_REQUEST['url']);
            
            $controller->getResponse()->removeHeader('Location');   //clear the existing redirect
            
            return $controller->redirect($noActionURL, 302);
        }

        $canView=$this->record->canView();
        $canEdit=$this->record->canEdit();
        $canDelete=$this->record->canDelete();
        $canCreate=$this->record->canCreate();

        if(!$canView) {
            return $this->getToplevelController()->httpError(403);
        }
        
        $actions=new FieldList();
        if($this->record->ID!==0) {
            if($canEdit) {
                $actions->push(FormAction::create('doSave', _t('GridFieldDetailForm.Save', 'Save'))
                                                ->setUseButtonTag(true)
                                                ->addExtraClass('ss-ui-action-constructive')
                                                ->setAttribute('data-icon', 'accept'));
            }
            
            if($canDelete) {
                $actions->push(FormAction::create('doDelete', _t('GridFieldDetailForm.Delete', 'Delete'))
                                                ->setUseButtonTag(true)
                                                ->addExtraClass('ss-ui-action-destructive action-delete'));
            }
        }else { // adding new record
            //Change the Save label to 'Create'
            $actions->push(FormAction::create('doSave', _t('GridFieldDetailForm.Create', 'Create'))
                                            ->setUseButtonTag(true)
                                            ->addExtraClass('ss-ui-action-constructive')
                                            ->setAttribute('data-icon', 'add'));
            
            // Add a Cancel link which is a button-like link and link back to one level up.
            $curmbs = $this->Breadcrumbs();
            if($curmbs && $curmbs->count()>=2){
                $one_level_up = $curmbs->offsetGet($curmbs->count()-2);
                $text=sprintf(
                    "<a class=\"%s\" href=\"%s\">%s</a>",
                    "crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all", // CSS classes
                    $one_level_up->Link, // url
                    _t('GridFieldDetailForm.CancelBtn', 'Cancel') // label
                );
                
                $actions->push(new LiteralField('cancelbutton', $text));
            }
        }
        
        // If we are creating a new record in a has-many list, then
        // pre-populate the record's foreign key.
        if($list instanceof HasManyList && !$this->record->isInDB()) {
            $key=$list->getForeignKey();
            $id=$list->getForeignID();
            $this->record->$key=$id;
        }
        
        $fields=$this->component->getFields();
        if(!$fields) {
            $fields=($this->record->hasMethod('getFrontEndFields') ? $this->record->getFrontEndFields():$this->record->getCMSFields());
        }
        
        // If we are creating a new record in a has-many list, then
        // Disable the form field as it has no effect.
        if($list instanceof HasManyList) {
            $key=$list->getForeignKey();
            
            if($field=$fields->dataFieldByName($key)) {
                $fields->makeFieldReadonly($field);
            }
        }
        
        // this pushes the current page ID in as a hidden field
        // this means the request will have the current page ID in it
        // rather than relying on session which can have been rewritten
        // by the user having another tab open
        // see LeftAndMain::currentPageID
        if($this->controller->hasMethod('currentPageID') && $this->controller->currentPageID()) {
            $fields->push(new HiddenField('CMSMainCurrentPageID', null, $this->controller->currentPageID()));
        }
        
        // Caution: API violation. Form expects a Controller, but we are giving it a RequestHandler instead.
        // Thanks to this however, we are able to nest GridFields, and also access the initial Controller by
        // dereferencing GridFieldDetailForm_ItemRequest->getController() multiple times. See getToplevelController
        // below.
        $form=new Form(
            $this,
            'ItemEditForm',
            $fields,
            $actions,
            $this->component->getValidator()
        );
        
        $form->loadDataFrom($this->record, ($this->record->ID==0 ? Form::MERGE_IGNORE_FALSEISH:Form::MERGE_DEFAULT));
        
        if($this->record->ID && !$canEdit) {
            // Restrict editing of existing records
            $form->makeReadonly();
            
            // Hack to re-enable delete button if user can delete
            if($canDelete) {
                $form->Actions()->fieldByName('action_doDelete')->setReadonly(false);
            }
        }else if(!$this->record->ID && !$canCreate) {
            // Restrict creation of new records
            $form->makeReadonly();
        }
        
        // Load many_many extraData for record.
        // Fields with the correct 'ManyMany' namespace need to be added manually through getCMSFields().
        if($list instanceof ManyManyList) {
            $extraData=$list->getExtraData('', $this->record->ID);
            $form->loadDataFrom(array('ManyMany' => $extraData));
        }
        
        $cb=$this->component->getItemEditFormCallback();
        if($cb) {
            $cb($form, $this);
        }
        
        $this->extend("updateItemEditForm", $form);
        return $form;
    }
215679
public function getEditor()
    {
        $provider = $this->getObject('user.provider');

        if($this->hasProperty('modified_by') && !empty($this->modified_by))
        {
            if($this->_editor_id && $this->_editor_id == $this->modified_by
                && !$provider->isLoaded($this->modified_by))
            {
                $data = array(
                    'id'         => $this->_editor_id,
                    'email'      => $this->_editor_email,
                    'name'       => $this->_editor_name,
                    'username'   => $this->_editor_username,
                    'authentic'  => false,
                    'enabled'    => !$this->_editor_block,
                    'expired'    => (bool) $this->_editor_activation,
                    'attributes' => json_decode($this->_editor_params)
                );

                $user = $provider->store($this->_editor_id, $data);
            }
            else $user = $provider->load($this->modified_by);
        }
        else $user = $provider->load(0);

        return $user;
    }
295674
public function status()
	{
		if ($this->status === null) {
			$stdClass = $this->decoded();
			if ( ! $stdClass instanceof stdClass)
				return null;

			$this->status = $this->resolveStatusFromStdClass($stdClass);
		}

		return $this->status;
	}
1248584
public function getStatus() {
        $rest = $this->getService( self::API_SWITCH_STATUS);
        $rest->GET();

        return $rest->getResult( models\SwitchPort\Status::class);
    }
828557
public function form()
    {
        $userModel = config('admin.database.users_model');
        $permissionModel = config('admin.database.permissions_model');
        $roleModel = config('admin.database.roles_model');

        $form = new Form(new $userModel());

        $form->display('id', 'ID');

        if (request()->isMethod('POST')) {
            $userTable = config('admin.database.users_table');
            $userNameRules = "required|unique:{$userTable}";
        } else {
            $userNameRules = 'required';
        }

        $form->text('username', trans('admin.username'))->rules($userNameRules);
        $form->text('name', trans('admin.name'))->rules('required');
        $form->image('avatar', trans('admin.avatar'));
        $form->password('password', trans('admin.password'))->rules('required|confirmed');
        $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
            ->default(function ($form) {
                return $form->model()->password;
            });

        $form->ignore(['password_confirmation']);

        $form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id'));
        $form->multipleSelect('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));

        $form->display('created_at', trans('admin.created_at'));
        $form->display('updated_at', trans('admin.updated_at'));

        $form->saving(function (Form $form) {
            if ($form->password && $form->model()->password != $form->password) {
                $form->password = bcrypt($form->password);
            }
        });

        return $form;
    }
1009856
public function getContextSelectorForm()
    {
        if (!$this->contextSelectorForm) {
            if (!$this->contextSelectorType || !$this->formFactory) {
                return null;
            }

            $formOptions = [
                'action' => $this->requestUri,
                'attr' => [
                    'novalidate' => 'novalidate',
                    'class' => 'form-inline',
                ],
            ];
            $this->contextSelectorForm = $this->formFactory->createNamed(
                static::SESSION_KEY,
                $this->contextSelectorType,
                $this->getContext(),
                $formOptions
            );
        }

        return $this->contextSelectorForm;
    }
834971
public function index()
    {
        $leftandmain = Injector::inst()->create(LeftAndMain::class);

        $form = $this->Form();
        $form->setTemplate($leftandmain->getTemplatesWithSuffix('_EditForm'));
        $form->addExtraClass('cms-edit-form center cms-content');
        $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
        
        if ($this->request->isAjax()) {
            $response = new HTTPResponse(
                Convert::raw2json(array('Content' => $form->forAjaxTemplate()->getValue()))
            );
            $response->addHeader('X-Pjax', 'Content');
            $response->addHeader('Content-Type', 'text/json');
            $response->addHeader('X-Title', 'SilverStripe - Bulk ' . $this->gridField->list->dataClass . ' Editing');

            return $response;
        } else {
            $controller = $this->getToplevelController();
            return $controller->customise(array('Content' => $form));
        }
    }
553357
public function status() {
		$request = new CPS_StatusRequest();
		$this->_lastResponse = $this->_connection->sendRequest($request);
		return $this->_lastResponse->getStatus();
	}
819563
public function getStatus()
    {
        $status = null;

        if($entity = $this->getIterator()->current()) {
            $status = $entity->getStatus();
        }

        return $status;
    }
176470
public function AttendeeForm() {
		$form = new EventAttendeeForm($this, "AttendeeForm");
		$this->extend("updateAttendeeForm", $form, $this->registration);
		if ($this->BackURL) {
			$form->addCancelLink($this->BackURL);
		}
		return $form;
	}
275430
public function getStatus() : ?string 
    {
        if ( ! $this->hasStatus()) {
            $this->setStatus($this->getDefaultStatus());
        }
        return $this->status;
    }
366219
public function editAction()
    {
        $id = $this->params()->fromRoute('id');
        $ids = [];
        if (! empty($id) && ! is_array($id)) {
            $ids = explode(',', $id);
        }
        if (empty($ids)) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The file ID(s) was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }

        try {
            $filesList = $this->getFileService()->getFilesList($ids);
        } catch (RuntimeException $e) {
            $this->flashMessenger()->addMessage($e->getMessage());
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }
        if ($filesList->isEmpty()) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('No files, available for editing.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }

        $form = $this->getFileEditForm();
        $form->setAttribute(
            'action',
            $this->url()->fromRoute(
                'sc-admin/file/edit',
                ['id' => $id]
            )
        );
        $form->bind($filesList);
        if ($this->getRequest()->isPost()) {
            $form->setData($this->params()->fromPost());
            if ($form->isValid()) {
                $this->getFileService()->saveFiles($filesList);
            }
        }
        return new ViewModel([
            'form' => $form
        ]);
    }