Add i18n string field

@param     $name
@param int $length

@return \Illuminate\Support\Fluent
778391
public function i18n_string($name, $length = 255)
    {
        $this->i18n_columns[] = $column = $this->createColumn($name, 'string', compact('length'));

        return $column;
    }
476950
public function addLink($name, $label = '', $attr = [] )
    {
        $e = new \FrenchFrogs\Form\Element\Link($name, $label, $attr);
        $this->addElement($e);
        return $e;
    }
970418
protected function fieldToSQL($name, $lang = '') {
		$fldname = $name;
		if ($lang != '') {
			$fldname .= '_' . $lang;
		}
		$db = \Brilliant\BFactory::getDBO();
		if (!isset($this->fields[$name])) {
			return '';
		}
		$type = $this->fields[$name]->type;
		$emptynull = isset($this->fields[$name]->emptynull) ? $this->fields[$name]->emptynull : false;
		switch ($type) {
			case 'int':
			case 'integer':
				$value = (int)$this->{$fldname};
				if (($emptynull) && (empty($value))) {
					return 'NULL';
				}
				return $value;
			case 'float':
				$value = (float)$this->{$fldname};
				if (($emptynull) && (empty($value))) {
					return 'NULL';
				}
				return $value;
			case 'itm':
			case 'item':
				$itemid = (int)$this->{$fldname};
				return empty($itemid) ? 'NULL' : $itemid;
			case 'bool':
			case 'boolean':
				return (int)$this->{$fldname};
			case 'str':
			case 'string':
				$value = $this->{$fldname};
				if (($emptynull) && (empty($value))) {
					return 'NULL';
				}
				return $db->escapeString($this->{$fldname});
			case 'binary':
				$value = $this->{$fldname};
				if (($emptynull) && (empty($value))) {
					return 'NULL';
				}
				return 'UNHEX(' . $db->escapeString($this->{$fldname}) . ')';
			case 'enum':
				return $db->escapeString($this->{$fldname});
			case 'dt':
				$obj = $this->{$fldname};
				if (!is_object($obj)) {
					//return '""';
					return 'NULL';
				}
				$s = $obj->format('Y-m-d H:i:s');
				return '"' . $s . '"';
			case 'image':
				$obj = $this->{$fldname};
				if (!is_object($obj)) {
					return NULL;
				}
				return $db->escapeString($obj->url);
			case 'json':
				$obj = $this->{$fldname};
				if (is_object($obj)) {
					return $db->escapeString(json_encode($obj));
				} elseif (is_array($obj)) {
					return $db->escapeString(json_encode($obj));
				}
				return '""';
		}
		die('[BItem] fieldToSQL() Unknown field type "' . $type . '"!');
	}
1367892
public function addFrom(string $address, ?string $name = null): Message
    {
        $this->from[] = [
            'address' => $address,
            'name'    => $name
        ];

        return $this;
    }
268276
public function first($length = null) {
		if ($length === null) {
			$length = 1;
		}

		$rawString = mb_substr($this->rawString, 0, $length, $this->charset);

		return new static($rawString, $this->charset);
	}
199183
private function mkstr($name, $type = 'string', $options = array())
    {
        $result = "  define('$name', ";
        $quot = "'";
        $value = isset($_POST[$name]) ? $_POST[$name] : null;

        if (isset($options['nobr']) && $options['nobr'])
        {
            $value = str_replace(array("\n", "\r"), ' ', $value);
        }

        if (isset($options['savebr']) && $options['savebr'])
        {
            $value = addcslashes($value, "\n\r\"");
            $quot = '"';
        }

        switch ($type)
        {
            case 'string':
                $value = str_replace(
                    array('\\', $quot),
                    array('\\\\', '\\' . $quot),
                    $value
                );
                $value = $quot . $value . $quot;
                break;
            case 'bool':
                $value = $value ? 'true' : 'false';
                break;
            case 'int':
                $value = intval($value);
                break;
        }
        $result .= $value . ");\n";
        return $result;
    }
88115
public function substring($start, $length = null)
    {

        if ($length == null) {
            $substring = substr($this->value, $start);
        } else {
            $substring = substr($this->value, $start, $length);
        }

        $this->value = $substring;

        return $this;


    }
431234
public function field_type($name = NULL, $length = NULL, $fvalue = '')
	{
		if ($this->fieldtype === TRUE) {
			$select	= '<option value="">-</option>
				<option value="INT" '.($name == 'INT' ? 'selected' : '').'>INT</option>
				<option value="TINYINT" '.($name == 'TINYINT' ? 'selected' : '').'>TINYINT</option>
				<option value="SMALLINT" '.($name == 'SMALLINT' ? 'selected' : '').'>SMALLINT</option>
				<option value="MEDIUMINT" '.($name == 'MEDIUMINT' ? 'selected' : '').'>MEDIUMINT</option>
				<option value="">-</option>
				<option value="DECIMAL" '.($name == 'DECIMAL' ? 'selected' : '').'>DECIMAL</option>
				<option value="FLOAT" '.($name == 'FLOAT' ? 'selected' : '').'>FLOAT</option>
				<option value="">-</option>
				<option value="CHAR" '.($name == 'CHAR' ? 'selected' : '').'>CHAR</option>
				<option value="VARCHAR" '.($name == 'VARCHAR' ? 'selected' : '').'>VARCHAR</option>
				<option value="TEXT" '.($name == 'TEXT' ? 'selected' : '').'>TEXT</option>
				<option value="MEDIUMTEXT" '.($name == 'MEDIUMTEXT' ? 'selected' : '').'>MEDIUMTEXT</option>';
		} elseif (count($this->fieldtype) > 1) {
			$select	= '<option value="">-</option>';
			foreach ($this->fieldtype as $t) {
				$select	= "<option value=\"{$t}\" ".($name == $t ? "selected" : "").">{$t}</option>";
			}
		} else {
			return '
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::fields.default.value').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	              <input type="text" name="setting[option][fvalue]" value="'.$fvalue.'" class="hstui-input hstui-length-5">
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::fields.default.value.tips').'">'.hst_lang('hstcms::fields.default.value.tips').'</div>
	          </div>
	        </div>';
		}
		$str = '
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::manage.fields.fieldtype').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	             	<select class="hstui-input hstui-textarea" name="setting[option][fieldtype]" onChange="setlength()" id="type">
						'.$select.'
					</select>
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::manage.fields.fieldtype.tips').'">'.hst_lang('hstcms::manage.fields.fieldtype.tips').'</div>
	          </div>
	        </div>
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::manage.fields.length.value').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	              <input type="text" name="setting[option][fieldlength]" value="'.$length.'" class="hstui-input hstui-length-5">
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::manage.fields.length.value.tips').'">'.hst_lang('hstcms::manage.fields.length.value.tips').'</div>
	          </div>
	        </div>
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::fields.default.value').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	              <input type="text" name="setting[option][fvalue]" value="'.$fvalue.'" class="hstui-input hstui-length-5">
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::fields.default.value.tips').'">'.hst_lang('hstcms::fields.default.value.tips').'</div>
	          </div>
	        </div>';
		return $str; 
	}
916994
public function updateLanguage(
        LanguageUpdateData $data,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: sprintf('update-language-%d', $data->getLanguage()->id);

        return $this->formFactory->createNamed($name, LanguageUpdateType::class, $data);
    }
6482
public function addSupportedLanguage($language, $name = "defaultTranslationService", $selfedit="false") {
		$this->addTranslationLanguageFromService(($selfedit == "true"), $name, $language);
		
		// Once more to reaload languages list
		$this->supportedLanguages($name, $selfedit);
	}
398892
protected function _createId($length = 32)
	{
		$id = '';

		while (strlen($id) < $length)  {
			$id .= mt_rand(0, mt_getrandmax());
		}

		$id	= md5(uniqid($id, true));

		return $id;
	}
988478
public function createMessageFile($name = "defaultTranslationService", $selfedit="false", $language) {
	
		$this->addTranslationLanguageFromService(($selfedit == "true"), $name, $language);
		
		header('location:'.$_SERVER['HTTP_REFERER']);
	}
664088
public function createStringColumn(string $name, int $length, string $charset = null): StringColumn {
		$column = new CommonStringColumn($name, $length, $charset);
		$this->table->addColumn($column);
		return $column;
	}
1363712
public function setLang($lang, $name, $sectionName = null, $elementName = null)
    {
        $setting = ['NAME' => $name];

        if ($sectionName) {
            $setting['SECTION_NAME'] = $sectionName;
        }
        if ($elementName) {
            $setting['ELEMENT_NAME'] = $elementName;
        }

        $this->fields['LANG'][$lang] = $setting;

        return $this;
    }
34521
public function string($column, $length = 255)
    {
        return $this->table->addColumn($column, Type::STRING, compact('length'));
    }
371868
public function createBatchActionForm($name)
    {
        /** @var AbstractAdmin $admin */
        $admin = $this->getAdmin();

        $container = $admin->getContainer();

        return $container->get('form.factory')->createNamedBuilder($name, 'form', [], [
            'label_format' => 'form.label_%name%',
            'translation_domain' => $admin->getTranslationDomain(),
        ]);
    }
651419
public function newParameterPart($name, $value, $language = null)
    {
        return new ParameterPart($this->charsetConverter, $name, $value, $language);
    }