Creates and adds a single subfield from the MARCspecParser result.

@param array $_subfield The MARCspecParser result array
10566
private function addSubfield($_subfield)
    {
        if (array_key_exists('subfieldtagrange', $_subfield)) {
            $_subfieldRange = $this->handleSubfieldRanges($_subfield['subfieldtagrange']);
        } else {
            $_subfieldRange[] = $_subfield['subfieldtag'];
        }

        foreach ($_subfieldRange as $subfieldTag) {
            $Subfield = new Subfield((string) $subfieldTag);

            if (array_key_exists('index', $_subfield)) {
                $_pos = $this->validatePos($_subfield['index']);

                $Subfield->setIndexStartEnd($_pos[0], $_pos[1]);
            } else {
                // as of MARCspec 3.2.2 spec without index is always an abbreviation
                $Subfield->setIndexStartEnd(0, '#');
            }

            if (array_key_exists('charpos', $_subfield)) {
                $_chars = $this->validatePos($_subfield['charpos']);

                $Subfield->setCharStartEnd($_chars[0], $_chars[1]);
            }

            if (array_key_exists('subspecs', $_subfield)) {
                $_subSpecs = [];

                foreach ($_subfield['subspecs'] as $subspec) {
                    if (!array_key_exists('operator', $subspec)) {
                        foreach ($subspec as $orSubSpec) {
                            $_subSpecs[] = $this->createSubSpec($orSubSpec, $Subfield);
                        }
                        $Subfield->addSubSpec($_subSpecs);
                    } else {
                        $Subspec = $this->createSubSpec($subspec, $Subfield);

                        $Subfield->addSubSpec($Subspec);
                    }
                }
            }

            $this->addSubfields($Subfield);
        }
    }
387658
public function setSubRecord($field, $pre, $class, \Closure $all_do = null) {
        $this->subRecord[ $pre ] = ['class' => $class,
                                    'field' => $field,
                                    'all_do' => $all_do];
        return $this;
    }
1272515
public function add_fields( $fields )
	{
		if ( !is_array( $fields ) )
		{
			$fields = array( $fields );
		}
		
		// merge the new values with the existing ones.
		$this->fields = array_merge( $this->fields, $fields ); 
	
		// return self so we can continue running the next function
		return $this;
	}
423506
function create_field( $field )
	{
		// require the googlemaps JS ( this script is now lazy loaded via JS )
		//wp_enqueue_script('acf-googlemaps');
		
		
		// default value
		if( !is_array($field['value']) )
		{
			$field['value'] = array();
		}
		
		$field['value'] = wp_parse_args($field['value'], array(
			'address'	=> '',
			'lat'		=> '',
			'lng'		=> ''
		));
		
		
		// default options
		foreach( $this->default_values as $k => $v )
		{
			if( ! $field[ $k ] )
			{
				$field[ $k ] = $v;
			}	
		}
		
		
		// vars
		$o = array(
			'class'		=>	'',
		);
		
		if( $field['value']['address'] )
		{
			$o['class'] = 'active';
		}
		
		
		$atts = '';
		$keys = array( 
			'data-id'	=> 'id', 
			'data-lat'	=> 'center_lat',
			'data-lng'	=> 'center_lng',
			'data-zoom'	=> 'zoom'
		);
		
		foreach( $keys as $k => $v )
		{
			$atts .= ' ' . $k . '="' . esc_attr( $field[ $v ] ) . '"';	
		}
		
		?>
		<div class="acf-google-map <?php echo $o['class']; ?>" <?php echo $atts; ?>>
			
			<div style="display:none;">
				<?php foreach( $field['value'] as $k => $v ): ?>
					<input type="hidden" class="input-<?php echo $k; ?>" name="<?php echo esc_attr($field['name']); ?>[<?php echo $k; ?>]" value="<?php echo esc_attr( $v ); ?>" />
				<?php endforeach; ?>
			</div>
			
			<div class="title">
				
				<div class="has-value">
					<a href="#" class="acf-sprite-remove ir" title="<?php _e("Clear location",'acf'); ?>">Remove</a>
					<h4><?php echo $field['value']['address']; ?></h4>
				</div>
				
				<div class="no-value">
					<a href="#" class="acf-sprite-locate ir" title="<?php _e("Find current location",'acf'); ?>">Locate</a>
					<input type="text" placeholder="<?php _e("Search for address...",'acf'); ?>" class="search" />
				</div>
				
			</div>
			
			<div class="canvas" style="height: <?php echo $field['height']; ?>px">
				
			</div>
			
		</div>
		<?php
	}
204964
public static function addTo( $key, $subKey, $value = null )
    {
        Option::addTo( static::$_options, static::_getKeyTag( $key ), $subKey, $value );
    }
1124662
protected function _createSubFormAtIndex($index) {
        $class = 'garp-subform';
        if ($this->isDuplicatable()) {
            $class .= ' duplicatable';
        }
        $subform = new Garp_Form_SubForm(array(
            'name' => (string)$index,
            'class' => $class
        ));
        if (is_array($this->_duplicatableOptions)) {
            if (!empty($this->_duplicatableOptions['buttonClass'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-class', $this->_duplicatableOptions['buttonClass']);
            }
            if (!empty($this->_duplicatableOptions['buttonAddClass'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-add-class', $this->_duplicatableOptions['buttonAddClass']);
            }
            if (!empty($this->_duplicatableOptions['buttonRemoveClass'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-remove-class', $this->_duplicatableOptions['buttonRemoveClass']);
            }
            if (!empty($this->_duplicatableOptions['buttonAddLabel'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-add-text', $this->_duplicatableOptions['buttonAddLabel']);
            }
            if (!empty($this->_duplicatableOptions['buttonRemoveLabel'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-remove-text', $this->_duplicatableOptions['buttonRemoveLabel']);
            }
            if (!empty($this->_duplicatableOptions['skipElements'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-skip-elements', $this->_duplicatableOptions['skipElements']);
            }
            if (!empty($this->_duplicatableOptions['afterDuplicate'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-after-duplicate', $this->_duplicatableOptions['afterDuplicate']);
            }
        }
        return $subform;
    }
537662
private BitFieldArgs addSubCommand(SubCommand subCommand) {

        LettuceAssert.notNull(subCommand, "SubCommand must not be null");
        commands.add(subCommand);
        return this;
    }
1361779
function create_field( $field )
	{
		// vars
		$optgroup = false;
		
		
		// determin if choices are grouped (2 levels of array)
		if( is_array($field['choices']) )
		{
			foreach( $field['choices'] as $k => $v )
			{
				if( is_array($v) )
				{
					$optgroup = true;
				}
			}
		}
		
		
		// value must be array
		if( !is_array($field['value']) )
		{
			// perhaps this is a default value with new lines in it?
			if( strpos($field['value'], "\n") !== false )
			{
				// found multiple lines, explode it
				$field['value'] = explode("\n", $field['value']);
			}
			else
			{
				$field['value'] = array( $field['value'] );
			}
		}
		
		
		// trim value
		$field['value'] = array_map('trim', $field['value']);
		
		
		// multiple select
		$multiple = '';
		if( $field['multiple'] )
		{
			// create a hidden field to allow for no selections
			echo '<input type="hidden" name="' . $field['name'] . '" />';
			
			$multiple = ' multiple="multiple" size="5" ';
			$field['name'] .= '[]';
		} 
		
		
		// html
		echo '<select id="' . $field['id'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';	
		
		
		// null
		if( $field['allow_null'] )
		{
			echo '<option value="null">- ' . __("Select",'acf') . ' -</option>';
		}
		
		// loop through values and add them as options
		if( is_array($field['choices']) )
		{
			foreach( $field['choices'] as $key => $value )
			{
				if( $optgroup )
				{
					// this select is grouped with optgroup
					if($key != '') echo '<optgroup label="'.$key.'">';
					
					if( is_array($value) )
					{
						foreach($value as $id => $label)
						{
							$selected = in_array($id, $field['value']) ? 'selected="selected"' : '';
														
							echo '<option value="'.$id.'" '.$selected.'>'.$label.'</option>';
						}
					}
					
					if($key != '') echo '</optgroup>';
				}
				else
				{
					$selected = in_array($key, $field['value']) ? 'selected="selected"' : '';
					echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
				}
			}
		}

		echo '</select>';
	}
1347130
public static function transform_sub_post_fields( &$field ) {
		if ( is_array( $field['value'] ) ) {
			$data = [];
			foreach ( $field['value'] as $post_id ) {
				$data[] = Acf::get_post_field( $post_id );
			}
			$field['value'] = $data;
		} else {
			$field['value'] = Acf::get_post_field( $field['value'] );
		}
	}
1124936
public function addFieldCache($field)
    {
        if ( !$cache = $this->getMongator()->getFieldsCache() ) {
            return null;
        }

        $field = preg_replace('/\.\d+/', '', $field);

        foreach ($this->getQueryHashes() as $hash) {
            $value = $cache->get($hash);
            if (!$value) $value = array();

            if ( !isset($value['fields'][$field]) || $value['fields'][$field] != 1 ) {
                $value['fields'][$field] = 1;
                $cache->set($hash, $value);
            }
        }
    }
966593
private function addBrackets($text, $subPattern = null)
    {
        if ($text instanceof VerbalExpression) {
            return $text->compile();
        }

        return $this->generateOpeningBracket($subPattern) .  $text . ')';
    }
422914
public function addFields(array $fields)
    {
        foreach ($fields as $field)
        {
            $name = $field->getName();
            $addFields[$name] = $field; # we key by name to prevent duplicates!
        }
        
        $keysString = "";
        $fieldStrings = array();
        
        foreach ($addFields as $fieldName => $field)
        {
            $fieldStrings[] = $field->getFieldString();
                
            /* @var $field DatabaseField */
            if ($field->isPrimaryKey())
            {
                $errMsg = 'Do not set field to be primary key when adding fields. ' .
                          'Instead, use the changePrimaryKey method';
                throw new \Exception($errMsg);
            }
            elseif ($field->isKey())
            {
                if ($keysString !== "")
                {
                    $keysString .= ", ";
                }
                
                if ($field->isUnique())
                {
                    $keysString .= "UNIQUE ";
                }
                
                $keysString .= "KEY (`" . $fieldName . "`) ";
            }
        }
        
        $fieldsString = implode(", ", $fieldStrings);
        
        $fieldsString .= $keysString;
        
        $query = 
            "ALTER TABLE " . 
            "`" . $this->m_name . "` " . 
            "ADD " .
            "(" . $fieldsString . ") ";
        
        $result = $this->m_mysqliConn->query($query);
        
        if ($result !== TRUE)
        {
            throw new \Exception('Error creating table with query: ' . $query);
        }
    }
1338688
public function addField($objField)
    {
        if (get_class($objField) == "ValidFormBuilder\\Fieldset") {
            $objField->setMeta("parent", $this, true);
            $this->__elements->addObject($objField);
        } else {
            if ($this->__elements->count() == 0) {
                $objFieldset = new Fieldset();
                $this->__elements->addObject($objFieldset);
            }

            $objFieldset = $this->__elements->getLast();

            $objField->setMeta("parent", $objFieldset, true);
            $objFieldset->getFields()->addObject($objField);

            if ($objField->isDynamic() && get_class($objField) !== "ValidFormBuilder\\MultiField"
                    && get_class($objField) !== "ValidFormBuilder\\Area") {
                $objHidden = new Hidden($objField->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array(
                    "default" => 0,
                    "dynamicCounter" => true
                ));

                $objFieldset->addField($objHidden);

                $objField->setDynamicCounter($objHidden);
            }
        }
    }
914451
public function add($field_list)
    {
        if (!is_array($field_list)) return false;

        foreach ($field_list as $value) {
            $field = new Query_Field();
            if (count($value) == 1) {
                $field->name              = $value;
                $this->field_list[$value] = $field;
                continue;
            }

            $field->name     = $value['name'];
            $field->function = $value['function'];

        }

        return true;
    }
1047491
public static function addFields()
    {
        $tags = ['text', 'text*', 'email', 'email*', 'url', 'url*', 'tel', 'tel*'];
        foreach ($tags as $tag) {
            //We have to remove tags before replacing them.
            wpcf7_remove_form_tag($tag);
        }
        wpcf7_add_form_tag($tags, [self::class, 'addCustomFields'], true);
    }
814440
public function addField($field)
    {
        if (! is_array($field) && ! $field instanceof AttachmentField) {
            throw FieldCannotBeAdded::invalidType();
        }

        if (is_array($field)) {
            $title = array_keys($field)[0];
            $value = $field[$title];

            $field = AttachmentField::create($title, $value);
        }

        $this->fields->push($field);

        return $this;
    }
812541
public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
    {
        if (!empty($subtree->subtrees)) {
            $this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
        } else {
            if ($subtree->data !== '') {
                $this->subtrees[] = $subtree;
            }
        }
    }