mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
(mvc) add optional description for empty item in OptionField
This commit is contained in:
parent
e1dd183993
commit
08c1e186d7
@ -47,11 +47,25 @@ class OptionField extends BaseField
|
||||
*/
|
||||
protected $internalValidationMessage = "option not in list";
|
||||
|
||||
|
||||
/**
|
||||
* @var string default description for empty item
|
||||
*/
|
||||
private $internalEmptyDescription = "none";
|
||||
|
||||
/**
|
||||
* @var array valid options for this list
|
||||
*/
|
||||
private $internalOptionList = array();
|
||||
|
||||
/**
|
||||
* set descriptive text for empty value
|
||||
* @param $value description
|
||||
*/
|
||||
public function setBlankDesc($value)
|
||||
{
|
||||
$this->internalEmptyDescription = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter for option values
|
||||
@ -83,7 +97,7 @@ class OptionField extends BaseField
|
||||
$result = array ();
|
||||
// if relation is not required, add empty option
|
||||
if (!$this->internalIsRequired) {
|
||||
$result[""] = array("value"=>"none", "selected" => 0);
|
||||
$result[""] = array("value"=>$this->internalEmptyDescription, "selected" => 0);
|
||||
}
|
||||
foreach ($this->internalOptionList as $optKey => $optValue) {
|
||||
if ($optKey == $this->internalValue) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user