Get form field instance with defined `autofocus` boolean attribute.
If there is no field in any form with this attribute, return `NULL`.
@param string $formId
@param string $fieldName
@return \MvcCore\Ext\Forms\Field|\MvcCore\Ext\Forms\IField
974485
public static function & GetAutoFocusedFormField ($formId, $fieldName) {
		if (self::$autoFocusedFormField) {
			list ($currentFormId, $currentFieldName) = self::$autoFocusedFormField;
			return self::GetById($currentFormId)->GetField($currentFieldName);
		}
		return NULL;
	}
1243764
public function indexAction($formId)
    {
        $form = $this->get('opifer.form.form_manager')->getRepository()->find($formId);

        if (!$form) {
            return $this->createNotFoundException();
        }

        $source = new Entity(Post::class);
        $tableAlias = $source->getTableAlias();
        $source->manipulateQuery(function ($query) use ($tableAlias, $form) {
            $query->andWhere($tableAlias.'.form = :form')->setParameter('form', $form);
        });

        $notificationAction = new RowAction('re-send', 'opifer_form_post_notification');
        $notificationAction->setRouteParameters(['id']);

        $viewAction = new RowAction('view', 'opifer_form_post_view');
        $viewAction->setRouteParameters(['id']);

        $deleteAction = new RowAction('delete', 'opifer_form_post_delete');
        $deleteAction->setRouteParameters(['id']);

        $grid = $this->get('grid');
        $grid->setId('posts')
            ->setSource($source)
            ->setDefaultOrder('id', 'desc')
            ->addRowAction($viewAction)
            ->addRowAction($notificationAction)
            ->addRowAction($deleteAction);

        return $grid->getGridResponse('OpiferCmsBundle:Backend/Post:index.html.twig', [
            'form' => $form
        ]);
    }
1150107
public function preSetData(FormEvent $event)
    {
        $entity = $event->getData();
        $form = $event->getForm();

        $entityConfiguration = $this->getTranslatableEntityConfiguration($entity);

        if (is_null($entityConfiguration)) {
            return null;
        }

        $entityFields = $entityConfiguration['fields'];

        foreach ($entityFields as $fieldName => $fieldConfiguration) {
            if (!$form->has($fieldName)) {
                continue;
            }

            $formConfig = $form
                ->get($fieldName)
                ->getConfig();

            $form
                ->remove($fieldName)
                ->add($fieldName, new TranslatableFieldType(
                    $this->entityTranslationProvider,
                    $formConfig,
                    $entity,
                    $fieldName,
                    $entityConfiguration,
                    $fieldConfiguration,
                    $this->locales,
                    $this->masterLocale,
                    $this->fallback
                ), [
                    'mapped' => false,
                ]);
        }
    }
281159
public function & GetField ($fieldName = '') {
		$result = NULL;
		if (isset($this->fields[$fieldName]))
			$result = & $this->fields[$fieldName];
		return $result;
	}
179411
public function load( $data, $formName = null ) {

		if( isset( $formName ) && isset( $data[ $formName ] ) ) {

			$this->data	= $data[ $formName ];
		}

		return parent::load( $data, $formName );
	}
1102379
protected function getAttributeValue($fieldId, $attributes)
    {
        /** @var EzInfoCollectionAttribute $attribute */
        foreach ($attributes as $attribute) {

            if ($fieldId === $attribute->getContentClassAttributeId()) {
                $value = $attribute->getValue();
                $value = str_replace('"', '""', $value);
                $value = str_replace(';', ', ', $value);
                $value = strip_tags($value);

                return preg_replace(array( '/\r|\n/' ), array( ' ' ), $value);

            }
        }

        return '';
    }
1237907
protected function getAffirmMethod($withFormRequest, array $fields, $requestNamespace, $input)
    {
        if ($withFormRequest || Helpers::isNewerThanOrEqualTo('5.5')) {
            return '';
        }

        $stub = $this->getStubContent('controller-affirm-method');

        $this->replaceValidationRules($stub, $this->getValidationRules($fields))
            ->replaceFileValidationSnippet($stub, $this->getFileValidationSnippet($fields, $input, $this->requestVariable))
            ->replaceRequestFullName($stub, $requestNamespace);

        return $stub;
    }
281133
public static function getInputByNameSelector($formName, $fieldName)
    {
        $formSelector = static::getFormByNameSelector($formName);
        $fieldName = trim($fieldName);

        if (empty($formSelector) || empty($fieldName)) {
            return '';
        }

        return sprintf('%s input[name="%s"]', $formSelector, $fieldName);
    }
802487
public function removeField(FormField $field)
    {
        if ($this->fields->contains($field) === true) {
            $field->setForm(null);
            $this->fields->removeElement($field);
        }

        return $this;
    }
734633
public function getChildFormView(FormView $formView, $elementId)
    {
        foreach (new \RecursiveIteratorIterator(new FormViewIterator($formView), \RecursiveIteratorIterator::SELF_FIRST) as $name => $formView) {
            if ($name === $elementId) {
                return $formView;
            }
        }
    }
1351022
protected function getValidatorForField($formKey)
    {
        $validator = null;
        if( isset($this->schema[$formKey]['options']['validator']) ) {
            $validator = $this->schema[$formKey]['options']['validator'];
            if(!is_callable($validator)) {
                $validator = null;
            }
        }
        return $validator;
    }
1159365
function &fieldNamed($fieldName)
    {
        $return = NULL;
        if (isset($this->_fields[$fieldName])) {
            $return =& $this->_fields[$fieldName];
        }

        return $return;
    }
1023474
public function getEditForm($id = null, $fields = null)
    {
        $config = FoxyStripeSetting::current_foxystripe_setting();
        $fields = $config->getCMSFields();

        // Tell the CMS what URL the preview should show
        $home = Director::absoluteBaseURL();
        $fields->push(new HiddenField('PreviewURL', 'Preview URL', $home));

        // Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
        $fields->push($navField = new LiteralField(
            'SilverStripeNavigator',
            $this->getSilverStripeNavigator()
        ));
        $navField->setAllowHTML(true);

        // Retrieve validator, if one has been setup (e.g. via data extensions).
        if ($config->hasMethod('getCMSValidator')) {
            $validator = $config->getCMSValidator();
        } else {
            $validator = null;
        }

        $actions = $config->getCMSActions();
        $negotiator = $this->getResponseNegotiator();
        $form = Form::create(
            $this,
            'EditForm',
            $fields,
            $actions,
            $validator
        )->setHTMLID('Form_EditForm');
        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $form) {
            $request = $this->getRequest();
            if ($request->isAjax() && $negotiator) {
                $result = $form->forTemplate();

                return $negotiator->respond($request, array(
                    'CurrentForm' => function () use ($result) {
                        return $result;
                    },
                ));
            }
            return null;
        });
        $form->addExtraClass('flexbox-area-grow fill-height cms-content cms-edit-form');
        $form->setAttribute('data-pjax-fragment', 'CurrentForm');

        if ($form->Fields()->hasTabSet()) {
            $form->Fields()->findOrMakeTab('Root')->setTemplate('SilverStripe\\Forms\\CMSTabSet');
        }
        $form->setHTMLID('Form_EditForm');
        $form->loadDataFrom($config);
        $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));

        // Use <button> to allow full jQuery UI styling
        $actions = $actions->dataFields();
        if ($actions) {
            /** @var FormAction $action */
            foreach ($actions as $action) {
                $action->setUseButtonTag(true);
            }
        }

        $this->extend('updateEditForm', $form);

        return $form;
    }
582011
public function addField(FormField $field)
    {
        if ($this->fields->contains($field) === false) {
            $field->setForm($this);
            $this->fields->add($field);
        }

        return $this;
    }
495976
public function relField($fieldName)
    {
        // default case
        if ($value = parent::relField($fieldName)) {
            return $value;
        }

        // check values for a form field with the matching name.
        $formField = SubmittedFormField::get()->filter(array(
            'ParentID' => $this->ID,
            'Name' => $fieldName
        ))->first();

        if ($formField) {
            return $formField->getFormattedValue();
        }
    }
1321389
private function getField($fieldname)
    {
        if (array_key_exists($fieldname, $this->colmodel)) {
            return $this->colmodel[$fieldname];
        } else {
            return false;
        }
    }
1218355
public function search($params, $formName = null)
    {
        $query = DpAdminMenuUrlRule::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params, $formName);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'rule_id' => $this->rule_id,
            'url_id' => $this->url_id,
            'status' => $this->status,
        ]);

        $query->andFilterWhere(['like', 'param_name', $this->param_name])
            ->andFilterWhere(['like', 'rule', $this->rule])
            ->andFilterWhere(['like', 'note', $this->note]);

        return $dataProvider;
    }