public function setAttribute($attr, $value) {

		$attr = strtolower($attr);

		if($attr === 'value') {
			return $this->setValue($value);
		}

		if($attr === 'name') {
			return $this->setName($value);
		}

		if($attr === 'id' && $this->label) {
		    $this->label->setAttribute('for', $value);
        }

		if(is_null($value)) {
			unset($this->attributes[$attr]);
		}
		else {
			$this->attributes[$attr] = $value;
		}
		return $this;

	}
public function setAttribute($attr, $value) {

		$attr = strtolower($attr);

		if($attr === 'value') {
			return $this->setValue($value);
		}

		if($attr === 'name') {
			return $this->setName($value);
		}

		if($attr === 'id' && $this->label) {
		    $this->label->setAttribute('for', $value);
        }

		if(is_null($value)) {
			unset($this->attributes[$attr]);
		}
		else {
			$this->attributes[$attr] = $value;
		}
		return $this;

	}
public function setAttribute ( $ attr , $ value ) { $ attr = strtolower ( $ attr ) ; if ( $ attr === 'value' ) { return $ this -> setValue ( $ value ) ; } if ( $ attr === 'name' ) { return $ this -> setName ( $ value ) ; } if ( $ attr === 'id' && $ this -> label ) { $ this -> label -> setAttribute ( 'for' , $ value ) ; } if ( is_null ( $ value ) ) { unset ( $ this -> attributes [ $ attr ] ) ; } else { $ this -> attributes [ $ attr ] = $ value ; } return $ this ; }
sets miscellaneous attribute of form element
attributes 'value', 'name' are treated by calling the according setters
setting 'id' will update 'for' when a label element is assigned

@param string $attr
@param mixed $value
@return \vxPHP\Form\FormElement\FormElement
sets miscellaneous attribute of form element attributes value name are treated by calling the according setters setting id will update for when a label element is assigned