Create new added fields to user or missing fields
187686
public function updateUserSettings(FilterUserFieldsEvent $userfields_filter)
    {
        $settings_manager = $userfields_filter->getContainer()->get('acs.setting_manager');

        $user = $userfields_filter->getContainer()->get('security.context')->getToken()->getUser();

        $fields_template = $userfields_filter->getUserFields();

        //if($settings_manager->isUpdateAvailable($user, 'user_schema_version', $fields_template['user_schema_version']['default_value'])){
            // We have an update in the user fields
            $settings_manager->loadSettingDefaults($fields_template, $user);
        //}
    }
592747
def add_field(self, name, default_value=None):
        """"""
        self._fields[name] = default_value

        def func(cluster):
            return self.get(name, cluster)

        setattr(self, name, func)
245468
function create_field( $field )
	{
		// load defaults
		// if field was loaded from db, these default will already be appield
		// if field was written by hand, it may be missing keys
		$field = apply_filters('acf/load_field_defaults', $field);
		
		
		// create field specific html
		do_action('acf/create_field/type=' . $field['type'], $field);
		
		
		// conditional logic
		if( $field['conditional_logic']['status'] )
		{
			$field['conditional_logic']['field'] = $field['key'];
			
			?>
<script type="text/javascript">
(function($) {
	
	if( typeof acf !== 'undefined' )
	{
		acf.conditional_logic.items.push(<?php echo json_encode($field['conditional_logic']); ?>);
	}
	
})(jQuery);	
</script>
			<?php
		}
		
	}
722313
def __collect_fields(self):
        
        form = FormData()
        form.add_field(self.__username_field, required=True,
                       error=self.__username_error)
        form.add_field(self.__password_field, required=True,
                       error=self.__password_error)
        form.parse()
        self.username = form.values[self.__username_field]
        self.password = form.values[self.__password_field]
        return
81151
function addUser(user) {
	var slElement = $(document.createElement("option"));
	slElement.attr("value", user);
	slElement.text(user);
	$("#usersList").append(slElement);
}
1306160
public function edit()
    {
        $this->new = false;
        $elements = $this->getElements();
        foreach ($this->getOriginalFields() as $field) {
            $this->add(array(
                'name' => 'original_' . $field,
                'attributes' => array(
                    'type' => 'hidden',
                    'value' => $elements[$field]->getValue(),
                )
            ));
            //$this->getFilter()->add(array(
            //    'name' => 'original_' . $field,
            //    'required' => true,
            //));
        }
        return $this;
    }
605772
def create(self, **fields):
        """"""
        entry = self.instance(**fields)
        entry.save()
        return entry
1110333
private function AddRequiredField()
    {
        $field = new Fields\Checkbox('Required', '1', $this->checkbox->GetRequired());
        $this->AddField($field);
    }
1289050
protected function fillDataForEmpty()
    {
        // Fill field references if they are empty
        $fields = [];

        // Add columns for attributes
        foreach ($this->info->attributes as $attribute) {

            if ($attribute->hidden || ! $this->shouldAttributeBeEditableByDefault($attribute, $this->info)) {
                continue;
            }

            $fields[ $attribute->name ] = $this->makeModelFormFieldDataForAttributeData($attribute);
        }


        // Add fields for relations
        foreach ($this->info->relations as $relation) {

            $fields[ $relation->name ] = $this->makeModelFormFieldDataForRelationData($relation);
        }


        $this->info->form->fields = $fields;
    }
1146049
def user_field_option_create(self, field_id, data, **kwargs):
        ""
        api_path = "/api/v2/user_fields/{field_id}/options.json"
        api_path = api_path.format(field_id=field_id)
        return self.call(api_path, method="POST", data=data, **kwargs)
388910
def update_fields(fields)
      attributes[:name]      = fields['name'] || attributes[:name]
      attributes[:id]        = fields['id'] || attributes[:id]
      attributes[:pos]       = fields['pos'] || attributes[:pos]
      attributes[:url]       = fields['url'] || attributes[:url]
      attributes[:bytes]     = fields['bytes'].to_i || attributes[:bytes]
      attributes[:member_id] = fields['idMember'] || attributes[:member_id]
      attributes[:date]      = Time.parse(fields['date']).presence || attributes[:date]
      attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
      attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
      attributes[:previews]  = fields['previews'] if fields.has_key?('previews')
      self
    end
737508
protected function AddUpdateFields(&$Fields) {
      $this->DefineSchema();
      if ($this->Schema->FieldExists($this->Name, $this->DateUpdated)) {
         if (!isset($Fields[$this->DateUpdated]))
            $Fields[$this->DateUpdated] = Gdn_Format::ToDateTime();
      }

      $Session = Gdn::Session();
      if ($Session->UserID > 0 && $this->Schema->FieldExists($this->Name, $this->UpdateUserID))
         if (!isset($Fields[$this->UpdateUserID]))
            $Fields[$this->UpdateUserID] = $Session->UserID;

      if ($this->Schema->FieldExists($this->Name, 'UpdateIPAddress') && !isset($Fields['UpdateIPAddress'])) {
         $Fields['UpdateIPAddress'] = Gdn::Request()->IpAddress();
      }
   }
213624
function create()
    {
        $content = $this->loadContentTypes();
        $templates = $this->loadTemplates();
        restoreRequest();
        $form = array (
            'name' => 'createPage',
            'caption' => strAdd,
            'width' => '600px',
            'fields' => array (
                array ('type' => 'hidden','name'=>'owner','value'=>arg('owner', 'int')),
                array ('type' => 'hidden','name'=>'action', 'value'=>'insert'),
                array ('type' => 'edit','name' => 'name','label' => admPagesName,'width' => '150px',
                    'maxlength' => '32', 'pattern'=>'/^[a-z0-9_]+$/i', 'errormsg'=>admPagesNameInvalid),
                array ('type' => 'edit','name' => 'title','label' => admPagesTitle,'width' => '100%',
                    'pattern'=>'/.+/', 'errormsg'=>admPagesTitleInvalid),
                array ('type' => 'edit','name' => 'caption','label' => admPagesCaption,'width' => '100%',
                    'maxlength' => '64', 'pattern'=>'/.+/', 'errormsg'=>admPagesCaptionInvalid),
                array ('type' => 'edit','name' => 'hint','label' => admPagesHint,'width' => '100%'),
                array ('type' => 'edit','name' => 'description','label' => admPagesDescription,
                    'width' => '100%'),
                array ('type' => 'edit','name' => 'keywords','label' => admPagesKeywords,'width' => '100%'),
                array ('type' => 'select','name' => 'template','label' => admPagesTemplate,
                    'items' => $templates[0], 'values' => $templates[1], 'default'=>pageTemplateDefault),
                array ('type' => 'select','name' => 'type','label' => admPagesContentType,
                    'items' => $content[0], 'values' => $content[1], 'default'=>contentTypeDefault),
                array ('type' => 'checkbox','name' => 'active','label' => admPagesActive, 'default'=>true),
                array ('type' => 'checkbox','name' => 'visible','label' => admPagesVisible,
                    'default'=>true),
                array ('type' => 'select','name' => 'access','label' => admAccessLevel,'access' => ADMIN,
                    'values'=>array(ADMIN,EDITOR,USER,GUEST),
                    'items' => array (ACCESSLEVEL2,ACCESSLEVEL3,ACCESSLEVEL4,ACCESSLEVEL5),
                    'default' => GUEST),
                array ('type' => 'edit','name' => 'position','label' => admPosition,'access' => ADMIN,
                    'width' => '4em','maxlength' => '5'),
                array ('type' => 'memo','name' => 'options','label' => admPagesOptions,'height' => '5')
            ),
            'buttons' => array('ok', 'cancel'),
        );

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->renderForm($form, Eresus_CMS::getLegacyKernel()->request['arg']);
        return $result;
    }
647056
private function create()
    {
        restoreRequest();
        $form = array(
            'name'=>'UserForm',
            'caption' => admUsersCreate,
            'width' => '400px',
            'fields' => array (
                array('type'=>'hidden','name'=>'action','value'=>'insert'),
                array('type'=>'edit','name'=>'name','label'=>admUsersName,'maxlength'=>32,'width'=>'100%',
                    'pattern'=>'/.+/', 'errormsg'=>admUsersNameInvalid),
                array('type'=>'edit','name'=>'login','label'=>admUsersLogin,'maxlength'=>16,'width'=>'100%',
                    'pattern'=>'/^[a-z0-9_]+$/i', 'errormsg'=>admUsersLoginInvalid),
                array('type'=>'select','name'=>'access','label'=>admAccessLevel, 'width'=>'100%',
                    'values'=>array('2','3','4'),'items'=>array(ACCESSLEVEL2,ACCESSLEVEL3,ACCESSLEVEL4),
                    'default' => USER),
                array('type'=>'checkbox','name'=>'active','label'=>admUsersAccountState, 'default' => true),
                array('type'=>'divider'),
                array('type'=>'password','name'=>'pswd1','label'=>admUsersPassword,'maxlength'=>32,
                    'width'=>'100%'),
                array('type'=>'password','name'=>'pswd2','label'=>admUsersConfirmation,'maxlength'=>32,
                    'width'=>'100%', 'equal'=>'pswd1', 'errormsg'=>admUsersConfirmInvalid),
                array('type'=>'divider'),
                array('type' => 'edit', 'name' => 'mail' , 'label' => admUsersMail,
                    'maxlength' => 32, 'width' => '100%'),
            ),
            'buttons'=>array('ok', 'cancel')
        );

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->renderForm($form, Eresus_CMS::getLegacyKernel()->request['arg']);
        return $result;
    }
1170710
def create(self, data, *args, **kwargs):
        
        super(MambuUser, self).create(data)
        self['user'][self.customFieldName] = self['customInformation']
        self.init(attrs=self['user'])
187544
protected function buildFields()
    {
        $this->debug->groupCollapsed(__METHOD__);
        $status = &$this->status;
        $persist = $this->persist;
        $pageI = $this->persist->get('i');
        $submitFieldCount = 0;
        $keys = \array_keys($this->currentFields);
        foreach ($keys as $k) {
            $field = $this->currentFields[$k];
            unset($this->currentFields[$k]);
            if (!\is_object($field)) {
                $field = $this->buildField($field, $k);
            }
            $field->pageI = $pageI;
            if ($field->attribs['type'] == 'newPage') {
                $this->debug->info('possible new page', $field->attribs['value']);
                if ($field->isRequired()) {
                    $this->debug->log('adding new page', $field->attribs['value']);
                    $status['additionalPages'][] = $field;
                }
                continue;
            } elseif ($field->attribs['type'] == 'submit') {
                $submitFieldCount++;
            } elseif ($field->attribs['type'] == 'file') {
                $status['multipart'] = true;
            }
            $k = \is_int($k)
                ? $field->attribs['name']
                : $k;
            $this->currentFields[$k] = $field;
        }
        if ($submitFieldCount < 1) {
            $this->debug->info('submit field not set');
            $fieldArray = array(
                'type'  => 'submit',
                'label' => ( !empty($status['additionalPages']) || $persist->pageCount() > $persist->pageCount(true)+1 )
                            ? 'Continue'
                            : 'Submit',
                'attribs' => array('class' => array('btn btn-primary', 'replace')),
                'tagOnly' => true,
            );
            $this->currentFields['submit'] = $this->fieldFactory->build($fieldArray);
            $this->debug->log('array_keys(currentFields)', \array_keys($this->currentFields));
        }
        if ($status['multipart']) {
            $this->debug->log('<a target="_blank" href="http://www.php.net/manual/en/ini.php">post_max_size</a> = '.Str::getBytes(\ini_get('post_max_size')));
            $this->debug->log('<a target="_blank" href="http://www.php.net/manual/en/ini.php">upload_max_filesize</a> = '.Str::getBytes(\ini_get('upload_max_filesize')));
        }
        $this->debug->groupEnd();
    }
13243
def fill_fields(self, **kwargs):
        """"""
        for name, value in kwargs.items():
            field = getattr(self, name)
            field.send_keys(value)