An abstract class for the form field controls

@class AbstractFormField
@abstract
@memberof CamSDK.form
778301
function AbstractFormField(element, variableManager) {
  this.element = $( element );
  this.variableManager = variableManager;

  this.variableName = null;

  this.initialize();
}
1135458
function _abstract_segment_template(segments){
	
	var maxibuf = new Array();
	for( var segkey in segments ){

	    var segval = segments[segkey];

	    // If the value looks like an array, iterate over it and
	    // collect.
	    if( segval &&
		segval != null &&
		typeof segval == 'object' &&
		segval.length ){

		for( var i = 0; i < segval.length; i++ ){
		    var minibuffer = new Array();
		    minibuffer.push(segkey);
		    minibuffer.push('=');
		    minibuffer.push(segval[i]);
		    maxibuf.push(minibuffer.join(''));
		}

	    }else{
		var minibuf = new Array();
		minibuf.push(segkey);
		minibuf.push('=');
		minibuf.push(segval);
		maxibuf.push(minibuf.join(''));
	    }
	}
	return maxibuf.join('&');
    }
1321377
protected function defineFormFields()
    {
        if ($this->fieldsDefined) {
            return;
        }

        /**
         * @event backend.form.extendFieldsBefore
         * Called before the form fields are defined
         *
         * Example usage:
         *
         *     Event::listen('backend.form.extendFieldsBefore', function((\Backend\Widgets\Form) $formWidget) {
         *         // You should always check to see if you're extending correct model/controller
         *         if (!$widget->model instanceof \Foo\Example\Models\Bar) {
         *             return;
         *         }
         *
         *         // Here you can't use addFields() because it will throw you an exception because form is not yet created
         *         // and it does not have tabs and fields
         *         // For this example we will pretend that we want to add a new field named example_field
         *         $widget->fields['example_field'] = [
         *             'label' => 'Example field',
         *             'comment' => 'Your example field',
         *             'type' => 'text',
         *         ];
         *     });
         *
         * Or
         *
         *     $formWidget->bindEvent('form.extendFieldsBefore', function () use ((\Backend\Widgets\Form $formWidget)) {
         *         // You should always check to see if you're extending correct model/controller
         *         if (!$widget->model instanceof \Foo\Example\Models\Bar) {
         *             return;
         *         }
         *
         *         // Here you can't use addFields() because it will throw you an exception because form is not yet created
         *         // and it does not have tabs and fields
         *         // For this example we will pretend that we want to add a new field named example_field
         *         $widget->fields['example_field'] = [
         *             'label' => 'Example field',
         *             'comment' => 'Your example field',
         *             'type' => 'text',
         *         ];
         *     });
         *
         */
        $this->fireSystemEvent('backend.form.extendFieldsBefore');

        /*
         * Outside fields
         */
        if (!isset($this->fields) || !is_array($this->fields)) {
            $this->fields = [];
        }

        $this->allTabs->outside = new FormTabs(FormTabs::SECTION_OUTSIDE, (array) $this->config);
        $this->addFields($this->fields);

        /*
         * Primary Tabs + Fields
         */
        if (!isset($this->tabs['fields']) || !is_array($this->tabs['fields'])) {
            $this->tabs['fields'] = [];
        }

        $this->allTabs->primary = new FormTabs(FormTabs::SECTION_PRIMARY, $this->tabs);
        $this->addFields($this->tabs['fields'], FormTabs::SECTION_PRIMARY);

        /*
         * Secondary Tabs + Fields
         */
        if (!isset($this->secondaryTabs['fields']) || !is_array($this->secondaryTabs['fields'])) {
            $this->secondaryTabs['fields'] = [];
        }

        $this->allTabs->secondary = new FormTabs(FormTabs::SECTION_SECONDARY, $this->secondaryTabs);
        $this->addFields($this->secondaryTabs['fields'], FormTabs::SECTION_SECONDARY);

        /**
         * @event backend.form.extendFields
         * Called after the form fields are defined
         *
         * Example usage:
         *
         *     Event::listen('backend.form.extendFields', function((\Backend\Widgets\Form) $formWidget) {
         *         // Only for the User controller
         *         if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
         *             return;
         *         }
         *
         *         // Only for the User model
         *         if (!$widget->model instanceof \RainLab\User\Models\User) {
         *             return;
         *         }
         *
         *         // Add an extra birthday field
         *         $widget->addFields([
         *             'birthday' => [
         *                 'label'   => 'Birthday',
         *                 'comment' => 'Select the users birthday',
         *                 'type'    => 'datepicker'
         *             ]
         *         ]);
         *
         *         // Remove a Surname field
         *         $widget->removeField('surname');
         *     });
         *
         * Or
         *
         *     $formWidget->bindEvent('form.extendFields', function () use ((\Backend\Widgets\Form $formWidget)) {
         *         // Only for the User controller
         *         if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
         *             return;
         *         }
         *
         *         // Only for the User model
         *         if (!$widget->model instanceof \RainLab\User\Models\User) {
         *             return;
         *         }
         *
         *         // Add an extra birthday field
         *         $widget->addFields([
         *             'birthday' => [
         *                 'label'   => 'Birthday',
         *                 'comment' => 'Select the users birthday',
         *                 'type'    => 'datepicker'
         *             ]
         *         ]);
         *
         *         // Remove a Surname field
         *         $widget->removeField('surname');
         *     });
         *
         */
        $this->fireSystemEvent('backend.form.extendFields', [$this->allFields]);

        /*
         * Convert automatic spanned fields
         */
        foreach ($this->allTabs->outside->getFields() as $fields) {
            $this->processAutoSpan($fields);
        }

        foreach ($this->allTabs->primary->getFields() as $fields) {
            $this->processAutoSpan($fields);
        }

        foreach ($this->allTabs->secondary->getFields() as $fields) {
            $this->processAutoSpan($fields);
        }

        /*
         * At least one tab section should stretch
         */
        if (
            $this->allTabs->secondary->stretch === null
            && $this->allTabs->primary->stretch === null
            && $this->allTabs->outside->stretch === null
        ) {
            if ($this->allTabs->secondary->hasFields()) {
                $this->allTabs->secondary->stretch = true;
            }
            elseif ($this->allTabs->primary->hasFields()) {
                $this->allTabs->primary->stretch = true;
            }
            else {
                $this->allTabs->outside->stretch = true;
            }
        }

        /*
         * Bind all form widgets to controller
         */
        foreach ($this->allFields as $field) {
            if ($field->type !== 'widget') {
                continue;
            }

            $widget = $this->makeFormFieldWidget($field);
            $widget->bindToController();
        }

        $this->fieldsDefined = true;
    }
1261767
final public static function formDefinition() : FinalizedFormObjectDefinition
    {
        $class = get_called_class();

        if (!isset(self::$definitions[$class])) {
            /** @var self $instance */
            $instance = (new \ReflectionClass($class))->newInstanceWithoutConstructor();
            $form     = new FormObjectDefinition(new ClassDefinition($instance, new \ReflectionClass(get_class($instance)), __CLASS__));
            $instance->defineForm($form);

            self::$definitions[$class] = $form->finalize();
        }

        return self::$definitions[$class];
    }
522648
void initializeFormRenderer(Form form) {
    getChildren().clear();
    preferencesFormRenderer = new PreferencesFxFormRenderer(form);
    getChildren().add(preferencesFormRenderer);
  }
1078902
function() {
            if (this._form){
                this._form.parentNode.removeChild(this._form);
                this._form = null;
            }
            if (this._iframe){
                this._iframe.parentNode.removeChild(this._iframe);
                this._iframe = null;
            }
            this._fields = null;
        }
251979
function(name, form) {
    //schemaDecorator is alias for whatever is set as default
    if (name === 'sfDecorator') {
      name = defaultDecorator;
    }

    var decorator = decorators[name];
    if (decorator[form.type]) {
      return decorator[form.type].template;
    }

    //try default
    return decorator['default'].template;
  }
1236772
def formfield(self, form_class=None, choices_form_class=None, **kwargs):
        """"""
        defaults = {
            'form_class': form_class or self.get_form_class()
        }
        defaults.update(kwargs)

        return super(ListField, self).formfield(**defaults)
444469
public function definition() {
        global $PAGE;
        $mform = $this->_form;

        $field = $this->_customdata['field'];
        if (!($field && $field instanceof field_controller)) {
            throw new \coding_exception('Field must be passed in customdata');
        }
        $handler = $field->get_handler();

        $mform->addElement('header', '_commonsettings', get_string('commonsettings', 'core_customfield'));

        $mform->addElement('text', 'name', get_string('fieldname', 'core_customfield'), 'size="50"');
        $mform->addRule('name', null, 'required', null, 'client');
        $mform->setType('name', PARAM_TEXT);

        // Accepted values for 'shortname' would follow [a-z0-9_] pattern,
        // but we are accepting any PARAM_TEXT value here,
        // and checking [a-zA-Z0-9_] pattern in validation() function to throw an error when needed.
        $mform->addElement('text', 'shortname', get_string('fieldshortname', 'core_customfield'), 'size=20');
        $mform->addHelpButton('shortname', 'shortname', 'core_customfield');
        $mform->addRule('shortname', null, 'required', null, 'client');
        $mform->setType('shortname', PARAM_TEXT);

        $desceditoroptions = $handler->get_description_text_options();
        $mform->addElement('editor', 'description_editor', get_string('description', 'core_customfield'), null, $desceditoroptions);
        $mform->addHelpButton('description_editor', 'description', 'core_customfield');

        // If field is required.
        $mform->addElement('selectyesno', 'configdata[required]', get_string('isfieldrequired', 'core_customfield'));
        $mform->addHelpButton('configdata[required]', 'isfieldrequired', 'core_customfield');
        $mform->setType('configdata[required]', PARAM_BOOL);

        // If field data is unique.
        $mform->addElement('selectyesno', 'configdata[uniquevalues]', get_string('isdataunique', 'core_customfield'));
        $mform->addHelpButton('configdata[uniquevalues]', 'isdataunique', 'core_customfield');
        $mform->setType('configdata[uniquevalues]', PARAM_BOOL);

        // Field specific settings from field type.
        $field->config_form_definition($mform);

        // Handler/component settings.
        $handler->config_form_definition($mform);

        // We add hidden fields.
        $mform->addElement('hidden', 'categoryid');
        $mform->setType('categoryid', PARAM_INT);

        $mform->addElement('hidden', 'type');
        $mform->setType('type', PARAM_COMPONENT);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $this->add_action_buttons(true);
    }
1370761
private <X> void onDeclaredFields(Class<X> clazz, AbstractManagedType<X> managedType)
    {
        Field[] embeddedFields = clazz.getDeclaredFields();
        for (Field f : embeddedFields)
        {
            if (isNonTransient(f))
            {
                new TypeBuilder<T>(f).build(managedType, f.getType());
            }
        }
    }
92180
function(e) {
      this.setClassFromState();
      // Clear the field when no value 
	    if (this.hiddenEl.value != this.el.value) this.hiddenEl.value = this.el.value;
   }
1331876
protected function InitForm()
    {
        $this->html = $this->LoadElement();
        $name = 'Html';
        $this->AddRichTextField($name, $this->html->GetHtml());
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddCacheLifetimeField();
        $this->AddSubmit();
    }
373364
function FormControlClone(props) {
    _classCallCheck(this, FormControlClone);

    var _this = _possibleConstructorReturn(this, (FormControlClone.__proto__ || Object.getPrototypeOf(FormControlClone)).call(this, props));

    _initialiseProps.call(_this);

    var _props$formControlCom = props.formControlComp.props,
        error = _props$formControlCom.error,
        required = _props$formControlCom.required;


    var name = void 0;
    var value = void 0;
    var helperText = void 0;
    var isError = error;

    _react2.default.Children.forEach(props.formControlComp.props.children, function (child) {
      if (child.type === _FormHelperText2.default) {
        helperText = String(child.props.children);
        _this.helperText = helperText;
      } else if (child.type !== _FormLabel2.default && child.type !== _InputLabel2.default && child.props.name !== undefined && child.props.value !== undefined) {
        name = child.props.name; // eslint-disable-line prefer-destructuring
        value = child.props.value; // eslint-disable-line prefer-destructuring
      }
    });

    if (props.formControlComp.type !== _FormControl2.default || name === undefined || value === undefined) {
      throw new Error('invalid FormControl control children');
    }

    if (props.field.value === undefined) {
      var validatorsPropName = _propNames2.default.FIELD_VALIDATORS;
      props.onConstruct(_defineProperty({
        name: name,
        value: value,
        required: required
      }, validatorsPropName, props.formControlComp.props[validatorsPropName]));
    } else {
      value = props.field.value; // eslint-disable-line prefer-destructuring
      if (!_lodash2.default.isEmpty(props.field) && props.field.validations.length > 0) {
        var fieldError = getErrorAndHelperText(props.field);
        helperText = fieldError.helperText; // eslint-disable-line prefer-destructuring
        isError = fieldError.isError; // eslint-disable-line prefer-destructuring
      }
    }

    _this.name = name;
    _this.state = {
      helperText: helperText,
      isError: isError,
      value: value
    };
    return _this;
  }
1023564
protected void setDetailForm(AbstractForm detailForm) {
		if (this.detailForm != null) {
			validationResultsModel.remove(this.detailForm.getFormModel()
					.getValidationResults());
		}

		this.detailForm = detailForm;

		if (this.detailForm != null) {
			validationResultsModel.add(this.detailForm.getFormModel()
					.getValidationResults());
		}
	}
828297
public function setFilteredField(Kwf_Form_Field_Abstract $field)
    {
        $property = $this->setProperty('filteredField', $field);
        $field->setNamePrefix($this->_namePrefix);
        return $property;
    }
118774
def formfield(self, **kwargs):
        """"""

        defaults = dict(
            form_class=LocalizedFieldForm,
            required=False if self.blank else self.required
        )
        defaults.update(kwargs)
        return super().formfield(**defaults)
475458
def js_for_has_many(class_string, &form_block)
      assoc_name       = assoc_klass.model_name
      placeholder      = "NEW_#{assoc_name.to_s.underscore.upcase.gsub(/\//, '_')}_RECORD"
      opts = {
        for: [assoc, assoc_klass.new],
        class: class_string,
        for_options: { child_index: placeholder }
      }
      html = template.capture { __getobj__.send(:inputs_for_nested_attributes, opts, &form_block) }
      text = new_record.is_a?(String) ? new_record : I18n.t('active_admin.has_many_new', model: assoc_name.human)

      template.link_to text, '#', class: "button has_many_add", data: {
        html: CGI.escapeHTML(html).html_safe, placeholder: placeholder
      }
    end