N°2847 - Edit/Create objects

This commit is contained in:
Eric
2020-09-29 17:35:02 +02:00
parent 078f81e853
commit b8d71b2bfb
12 changed files with 205 additions and 160 deletions

View File

@@ -22,16 +22,20 @@ class Form extends UIContentBlock
/** @var string */
protected $sOnSubmitJsCode;
/** @var string */
protected $sAction;
public function __construct(string $sName = null)
{
parent::__construct($sName);
$this->sOnSubmitJsCode = null;
$this->sAction = null;
}
public function SetOnSubmitJsCode(string $sJsCode): void
public function SetOnSubmitJsCode(string $sJsCode): Form
{
$this->sOnSubmitJsCode = $sJsCode;
return $this;
}
/**
@@ -42,5 +46,23 @@ class Form extends UIContentBlock
return $this->sOnSubmitJsCode;
}
/**
* @return string
*/
public function GetAction(): string
{
return $this->sAction;
}
/**
* @param string $sAction
*
* @return Form
*/
public function SetAction(string $sAction): Form
{
$this->sAction = $sAction;
return $this;
}
}

View File

@@ -22,6 +22,8 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
protected $aCSSClasses;
/** @var array */
protected $aSubBlocks;
/** @var array */
protected $aDataAttributes;
/**
* UIContentBlock constructor.
@@ -34,6 +36,7 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
parent::__construct($sName);
$this->aSubBlocks = [];
$this->aDataAttributes = [];
$this->SetCSSClasses($sContainerClass);
}
@@ -150,4 +153,36 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
return $this;
}
/**
* @return array
*/
public function GetDataAttributes(): array
{
return $this->aDataAttributes;
}
/**
* @param array $aDataAttributes
*
* @return UIContentBlock
*/
public function SetDataAttributes(array $aDataAttributes): UIContentBlock
{
$this->aDataAttributes = $aDataAttributes;
return $this;
}
/**
* @param string $sName
* @param string $sValue
*
* @return UIContentBlock
*/
public function AddDataAttributes(string $sName, string $sValue): UIContentBlock
{
$this->aDataAttributes[$sName] = $sValue;
return $this;
}
}