Version 0.3.5 beta

This commit is contained in:
Stephan Kasdorf
2018-03-14 16:37:09 +01:00
parent f7f7550833
commit c9f29ce086
152 changed files with 14954 additions and 1124 deletions

View File

@@ -8,62 +8,31 @@ use Nibiru\Adapter;
* Time: 20:59
*/
class Form implements IForm
class Form extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_METHOD => '',
self::FORM_ACTION => '',
self::FORM_TARGET => ''
self::FORM_NAME => '',
self::FORM_METHOD => '',
self::FORM_ACTION => '',
self::FORM_TARGET => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct($this->_attributes);
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET">' . "\n" . 'FIELDS</form>' . "\n";
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET" ID CLASS>' . "\n" . 'FIELDS</form>' . "\n";
}
}