Set the html type for a given field.

@param CrestApps\CodeGenerator\Models\Field $field
@param string $type

@return $this
433017
protected function setHtmlType(Field & $field, $type)
    {
        $map = $this->getMap();

        if (array_key_exists($type, $map)) {
            $field->htmlType = $map[$type];
        }

        return $this;
    }
109505
protected function setHtmlType(array &$fields)
    {
        foreach ($fields as $field) {
            $field->htmlType = $this->getHtmlType($field->getEloquentDataMethod());
        }

        return $this;
    }
615340
private function addColumn($field, $type = "migration", $meta = "")
    {

        if ($type == 'migration') {

            $syntax = sprintf("\$table->%s('%s')", $field['type'], $field['name']);

            // If there are arguments for the schema type, like decimal('amount', 5, 2)
            // then we have to remember to work those in.
            if ($field['arguments']) {
                $syntax = substr($syntax, 0, -1) . ', ';

                $syntax .= implode(', ', $field['arguments']) . ')';
            }

            foreach ($field['options'] as $method => $value) {
                $syntax .= sprintf("->%s(%s)", $method, $value === true ? '' : $value);
            }

            $syntax .= ';';


        } elseif ($type == 'view-index-header') {

            // Fields to index view
            $syntax = sprintf("<th>%s", strtoupper($field['name']));
            $syntax .= '</th>';

        } elseif ($type == 'view-index-content') {

            // Fields to index view
            $syntax = sprintf("<td>{{\$%s->%s", $meta['var_name'], strtolower($field['name']));
            $syntax .= '}}</td>';

        } elseif ($type == 'view-show-content') {

            // Fields to show view
            $syntax = sprintf("<div class=\"form-group\">\n" .
                str_repeat(' ', 21)."<label for=\"%s\">%s</label>\n" .
                str_repeat(' ', 21)."<p class=\"form-control-static\">{{\$%s->%s}}</p>\n" .
                str_repeat(' ', 16)."</div>", strtolower($field['name']), strtoupper($field['name']), $meta['var_name'], strtolower($field['name']));


        } elseif ($type == 'view-edit-content') {
            if (trim($field["type"]) == "text") {
                $content = "<textarea name=\"%s\" class=\"form-control\">{{ \App\Libs\ValueHelper::getOldInput(\$%s,'%s') }}</textarea>\n";
            } else {
                $content = "<input type=\"text\" name=\"%s\" class=\"form-control\" value=\"{{ \App\Libs\ValueHelper::getOldInput(\$%s,'%s') }}\"/>\n";
            }
            // Fields to show view
            $syntax = sprintf("<div class=\"form-group\">\n" .
                str_repeat(' ', 21)."<label for=\"%s\">%s</label>\n" .
                str_repeat(' ', 21). $content .
                str_repeat(' ', 21)."{!! \App\Libs\ErrorDisplay::getInstance()->displayIndividual(\$errors, \"%s\") !!}\n" .
                str_repeat(' ', 16)."</div>", strtolower($field['name']), strtoupper($field['name']), strtolower($field['name']), $meta['var_name'], strtolower($field['name']), strtolower($field['name']));


        } elseif ($type == 'view-create-content') {
            if (trim($field["type"]) == "text") {
                $content = "<textarea name=\"%s\" class=\"form-control\">{{ Session::getOldInput('%s') }}</textarea>\n";
            } else {
                $content = "<input type=\"text\" name=\"%s\" class=\"form-control\" value=\"{{  Session::getOldInput('%s') }}\"/>\n";
            }
            // Fields to show view
            $syntax = sprintf("<div class=\"form-group\">\n" .
                str_repeat(' ', 21)."<label for=\"%s\">%s</label>\n" .
                str_repeat(' ', 21). $content .
                str_repeat(' ', 21)."{!! \App\Libs\ErrorDisplay::getInstance()->displayIndividual(\$errors, \"%s\") !!}\n" .
                str_repeat(' ', 16)."</div>", strtolower($field['name']), strtoupper($field['name']), strtolower($field['name']), strtolower($field['name']), strtolower($field['name']));


        } else {

            // Fields to controller
            $syntax = sprintf("\$%s->%s = \$request->input(\"%s", $meta['var_name'], $field['name'], $field['name']);
            $syntax .= '");';
        }


        return $syntax;
    }
221109
function setEditType(field, editType) {
    var gridCompColumn = this.getColumnByField(field);
    gridCompColumn.options.editType = editType;
}
2248
private function addColumn($field, $type = "migration", $meta = "")
    {


        if ($type == 'migration') {

            $syntax = sprintf("\$table->%s('%s')", $field['type'], $field['name']);

            // If there are arguments for the schema type, like decimal('amount', 5, 2)
            // then we have to remember to work those in.
            if ($field['arguments']) {
                $syntax = substr($syntax, 0, -1) . ', ';

                $syntax .= implode(', ', $field['arguments']) . ')';
            }

            foreach ($field['options'] as $method => $value) {
                $syntax .= sprintf("->%s(%s)", $method, $value === true ? '' : $value);
            }

            $syntax .= ';';


        } elseif ($type == 'view-index-header') {

            // Fields to index view
            $syntax = sprintf("<th>%s", strtoupper($field['name']));
            $syntax .= '</th>';

        } elseif ($type == 'view-index-content') {

            // Fields to index view
            $syntax = sprintf("<td>{{\$%s->%s", $meta['var_name'], strtolower($field['name']));
            $syntax .= '}}</td>';

        } elseif ($type == 'view-show-content') {

            // Fields to show view
            $syntax = sprintf("<div class=\"form-group\">\n" .
                str_repeat(' ', 21) . "<label for=\"%s\">%s</label>\n" .
                str_repeat(' ', 21) . "<p class=\"form-control-static\">{{\$%s->%s}}</p>\n" .
                str_repeat(' ', 16) . "</div>", strtolower($field['name']), strtoupper($field['name']), $meta['var_name'], strtolower($field['name']));


        } elseif ($type == 'view-edit-content') {
            $syntax = $this->buildField($field, $type, $meta['var_name']);
        } elseif ($type == 'view-create-content') {
            $syntax = $this->buildField($field, $type, $meta['var_name'], false);
        } else {
            // Fields to controller
            $syntax = sprintf("\$%s->%s = \$request->input(\"%s", $meta['var_name'], $field['name'], $field['name']);
            $syntax .= '");';
        }


        return $syntax;
    }
926360
public function setType($type)
    {
        $this->type = $type;

        switch ($type) {
            case 'text':
            case 'string':
                $this->operatorOpts = ['equals', 'notequals', 'contains'];
                break;
            case 'integer':
                $this->operatorOpts = ['equals', 'notequals', 'greaterthan', 'lessthan'];
                break;
            case 'boolean':
                $this->operatorOpts = ['equals'];
                break;
        }

        return $this;
    }
992014
public function setField($field = null)
    {
        $this->field = null;

        if (!$field = $this->internalResolveField($field)) {
            $this->field = $this->fieldId = null;
        } else {
            $this->fieldId = $field->id;
            $this->field = $field;
        }

        return $this;
    }
38903
public function addFieldToQueryType(FieldDefinitionNode $field): self
    {
        $query = $this->queryTypeDefinition();
        $query->fields = ASTHelper::mergeNodeList($query->fields, [$field]);

        $this->setDefinition($query);

        return $this;
    }
975119
private function render(Field $field)
    {
        $field->set('lang', $this->language);
        $field->set('prefix', $this->buildPrefix($field));

        foreach ($this->fill($field->getAttributes()) as $key => $value) {
            $field->set($key, $value);
        }

        return $field->render();
    }
98160
public function setType($type)
    {
        $this->type = $type;
        if ($this->type == "xml") {
            $this->formatter = new XMLPDOResultFormatter();
        } elseif ($this->type == "plain") {
            $this->formatter = new PlainPDOResultFormatter();
        } else {
            throw new BuildException("Formatter '" . $this->type . "' not implemented");
        }
    }
662809
public function type($field)
    {
        if (!is_array($this->_context['schema'])) {
            return null;
        }

        $schema = Hash::get($this->_context['schema'], $field);
        if ($schema === null) {
            $schema = Hash::get($this->_context['schema'], $this->stripNesting($field));
        }

        return isset($schema['type']) ? $schema['type'] : null;
    }
446772
public function setTypes($attr, $type = null)
    {
        if (is_array($attr))
            $this->inputType = array_merge($this->inputType, $attr);
        else
            $this->inputType[$attr] = $type;

        return $this;
    }
417647
public function set(string $field, $value): Update
    {
        $this->what[$field] = $value;
        return $this;
    }
763272
protected function parseColumnType(Field $field, array $attributes)
    {
        $type = Type::retrieveTypeObject(strtolower($attributes['type']));
        
        $type->setLength(isset($attributes['length']) ? (integer) $attributes['length'] : 0);
        $type->setPrecision(isset($attributes['precision']) ? (integer) $attributes['precision'] : 0);
        
        switch (true) {
            case $type instanceof EnumType:
                $enumeration = explode(',', $attributes['enum']);
                $enumeration = array_map('trim', $enumeration);
                
                $type->setExtra($enumeration);
                break;
            
            case $type instanceof DatetimeType:
                if (isset($attributes['format'])) {
                    $type->setExtra(['format' => $attributes['format'],]);
                }
                break;
            
            case $type instanceof SimpleArrayType:
                if (isset($attributes['separator'])) {
                    $type->setExtra(['separator' => $attributes['separator'],]);
                }
                break;
            
            default:
                break;
        }
        
        $field->setType($type);
        
        return $this;
    }
341081
private function setByTypeFileField(CsvField $field) : void
    {
        if (! in_array($field->getType(), ['files', 'images'])) {
            return;
        }

        $this->setAssociation(
            'hasMany',
            static::generateAssociationName(FileUpload::FILE_STORAGE_TABLE_NAME, $field->getName()),
            [
                'className' => FileUpload::FILE_STORAGE_TABLE_NAME,
                'foreignKey' => 'foreign_key',
                'conditions' => ['model' => $this->getTable(), 'model_field' => $field->getName()]
            ]
        );
    }
903538
public function setType(?string $type, string $description = null) {
		$this->type = $type;
		if (null !== $description) {
			$this->setTypeDescription($description);
		}

		return $this;
	}
559459
public function addChange(
        string $field,
        $value,
        int $type = self::TYPE_VALUE
    ): self {
        $this->changes[] = [
            'field' => $field,
            'type' => $type,
            'value' => $value,
        ];

        return $this;
    }