Create textarea element.

@param $key
@param $val

@return $this
491682
protected function textarea($key, $val)
    {
        $value = null;
        $value = isset($val['value']) ? $val['value'] : '' ;
        unset($val['value']);

        $extra = ['type'  => 'textarea', 'value' => $value];

        return $this->composeElement($key, $val, $extra);
    }
621949
public function addAttribute($key, $value = null)
    {
        $this->element->addAttribute($key, $value);

        return $this;
    }
929398
function offsetset($key,$val) {
		return Base::instance()->visible($this,$key)?
			($this->$key=$val):$this->set($key,$val);
	}
545622
public static function set(array $root, string $key, $val){
        $origin = $root;
        $node   = &$root;

        foreach(explode(".", $key) as $key){
            if(!is_array($key) || !array_key_exists($key, $node)){
                return $origin;
            }

            $node   = &$node[$key];
        }

        $node   = $val;

        return $root;
    }
799893
public function set(string $key, $element): self
    {
        $this->validate($element);

        $this->elements[$key] = $element;

        foreach ($this->indexes as $index) {
            $index->add($key, $element);
        }

        return $this;
    }
974392
public function addPickerOption($key, $val)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'Setting key must be a string.'
            );
        }

        // Make sure default options are loaded.
        if ($this->pickerOptions === null) {
            $this->pickerOptions();
        }

        $this->pickerOptions[$key] = $val;

        return $this;
    }
873108
private function _setArray($key, $val) {
		preg_match("/<loop\." . $key . ">(.*?)<\/loop\." . $key . ">/s", $this->_result, $l);
		
		$loop_content = '';
		$loop = $l[1];
		foreach ($val as $v) {
			$loop_replaced = $loop;
			foreach ($v as $x => $y) {
				$loop_replaced = str_replace('{{' . $key . '.' . $x . '}}', $y, $loop_replaced);
			}
			$loop_content.= $loop_replaced;
		}
		
		$this->_result = preg_replace("/<loop\." . $key . ">(.*?)<\/loop\." . $key . ">/s", preg_quote($loop_content), $this->_result);
		$this->_result = stripslashes($this->_result);

		$this->_result = str_replace("<loop." . $key . ">", '', $this->_result);
		$this->_result = str_replace("</loop." . $key . ">", '', $this->_result);
	}
1005744
public function textarea($name = null, $value = null)
    {
        return Textarea::create()
            ->attributeIf($name, 'name', $this->fieldName($name))
            ->attributeIf($name, 'id', $this->fieldName($name))
            ->value($this->old($name, $value));
    }
853212
protected function _setRaw($key, $val) {
        $set = false;
        if ($val === null) {
            $this->_fields[$key] = null;
            $set = true;
        } else {
            $phptype = $this->_getPHPType($key);
            $dbtype = $this->_getDataType($key);
            switch ($phptype) {
                case 'int':
                case 'integer':
                case 'boolean':
                    $this->_fields[$key] = (integer) $val;
                    $set = true;
                    break;
                case 'float':
                    $this->_fields[$key] = (float) $val;
                    $set = true;
                    break;
                case 'array':
                    if (is_array($val)) {
                        $this->_fields[$key]= serialize($val);
                        $set = true;
                    } elseif (is_string($val)) {
                        $this->_fields[$key]= $val;
                        $set = true;
                    } elseif (is_object($val) && $val instanceof xPDOObject) {
                        $this->_fields[$key]= serialize($val->toArray());
                        $set = true;
                    }
                    break;
                case 'json':
                    if (!is_string($val)) {
                        $v = $val;
                        if (is_array($v)) {
                            $this->_fields[$key] = $this->xpdo->toJSON($v);
                            $set = true;
                        } elseif (is_object($v) && $v instanceof xPDOObject) {
                            $this->_fields[$key] = $this->xpdo->toJSON($v->toArray());
                            $set = true;
                        }
                    } else {
                        $this->_fields[$key]= $val;
                        $set = true;
                    }
                    break;
                case 'date':
                case 'datetime':
                case 'timestamp':
                    if (preg_match('/int/i', $dbtype)) {
                        $this->_fields[$key] = (integer) $val;
                        $set = true;
                        break;
                    }
                default:
                    $this->_fields[$key] = $val;
                    $set = true;
            }
        }
        if ($set) $this->setDirty($key);
        return $set;
    }
234949
public function flash($key, $val)
    {
        $this->set($key, $val);
        $this->setSessionInfo($key, 'expire', true);
    }
490767
protected function innerSet($key, $val)
    {
        $setMethod = 'set' . ucfirst($key);
        if ( !in_array($key, $this->notsetters()) && method_exists($this, $setMethod) ) {
            $this->$setMethod($val);
        } else {

            $validateMethod = 'validate' . ucfirst($key);

            if (method_exists($this, $validateMethod)) {

                $errors = new Exceptions();

                try {
                    $validateResult = $this->$validateMethod($val);
                    if (false === $validateResult) {
                        return;
                    }
                    if ($validateResult instanceof \Generator) {
                        foreach ($validateResult as $error) {
                            if ($error instanceof \Throwable) {
                                $errors->add($error);
                            }
                        }
                    }
                } catch (\Throwable $e) {
                    $errors->add($e);
                }

                if (!$errors->empty()) {
                    throw $errors;
                }

            }

            $sanitizeMethod = 'sanitize' . ucfirst($key);
            if (method_exists($this, $sanitizeMethod)) {
                $val = $this->$sanitizeMethod($val);
            }

            if (null === $key) {
                $this->__data[] = $val;
            } else {
                $this->__data[$key] = $val;
            }
        }
    }
484567
public function addWidgetData($key, $val)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'Setting key must be a string.'
            );
        }

        // Make sure default options are loaded.
        if ($this->widgetData === null) {
            $this->widgetData();
        }

        $this->widgetData[$key] = $val;

        return $this;
    }
680430
protected function custom($key, $val)
    {
        $extra = [
            'value' => (isset($val['name'])) ? $val['name'] : $key,
        ];

        return $this->composeElement($key, $val, $extra);
    }
381434
public static function make_label( $id, $key, $text = null, $attr = array() ) 
	{
		if ( is_null( $text ) )
		{
			$text = $key;
		}

		$element = HTML::tag( 'label', $text, array_merge( array( 
			'id' => $id, 
			'for' => static::build_id( 'input', $key ) 
		), $attr ));

		if ( !static::$builder_enabled )
		{
			 return $element;
		}

		return Builder::handle( 'form_label', $element );
	}
767091
public ValueMap withMap(String key, Map<String, ?> val) {
        super.put(key, val);
        return this;
    }
613157
protected function makePage($key, $val)
    {
        // Check if it's a divider
        if ($val === '-') {
            return (object) ['divider' => true];
        }

        // Create a new page
        $page = ['url' => $val, 'divider' => false];
        $page = array_merge($page, $this->makeIcon($key));

        // Check if this item is the currently selected one
        $page['active'] = false;
        if (strpos(URL::current(), parse_url($page['url'], PHP_URL_PATH))) {
            $page['active'] = true;
        }

        // Return the new page
        return (object) $page;
    }
1334654
protected function setValidationError($key, $val)
    {
        if (!in_array('submit', $val)) {
            // Is $validator is instance of ValidatorInterface and given key has error associated
            // then add a span tag below the input element and display error.
            if ($this->validator instanceof ValidatorInterface && $this->validator->hasError($key)) {
                $this->elements[self::$formHolder[self::$formName]][$key.'.error'] =
                    '<span class="'.$this->errorClass.'">'.$this->validator->getErrors($key).'</span>'.PHP_EOL;
            }
        }
    }