Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions core/Form/Primitives/BasePrimitive.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,34 @@ public function getRawValue()
{
return $this->raw;
}

public function getValueOrDefault()
{
if ($this->value !== null)
return $this->value;

return $this->default;
}

/**
* @deprecated since version 1.0
* @see getSafeValue, getValueOrDefault
*/
public function getActualValue()
{
if (null !== $this->value)
if ($this->value !== null)
return $this->value;
elseif ($this->imported)
return $this->raw;

return $this->default;
}

public function getSafeValue()
{
if ($this->imported)
return $this->value;

return $this->default;
}

Expand Down
19 changes: 9 additions & 10 deletions core/Form/Primitives/PrimitiveAlias.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,24 @@ public function getRawValue()
return $this->primitive->getRawValue();
}


public function getValueOrDefault()
{
return $this->primitive->getValueOrDefault();
}

/**
* @deprecated by getFormValue
* since version 1.0 by getValueOrDefault
**/
public function getActualValue()
{
if (null !== $this->primitive->getValue())
return $this->primitive->getValue();
elseif ($this->primitive->isImported())
return $this->primitive->getRawValue();

return $this->primitive->getDefault();
return $this->primitive->getActualValue();
}

public function getSafeValue()
{
if ($this->primitive->isImported())
return $this->primitive->getValue();

return $this->primitive->getDefault();
return $this->primitive->getSafeValue();
}

public function getFormValue()
Expand Down
21 changes: 17 additions & 4 deletions core/Form/Primitives/TimeList.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,30 @@ public function import($scope)

return ($this->value !== array());
}


public function getValueOrDefault()
{
if (is_array($this->value) && $this->value[0])
return $this->value;

return array($this->default);
}

/**
* @deprecated deprecated since version 1.0
* @see getSafeValue, getValueOrDefault
* @return type
*/
public function getActualValue()
{
if (is_array($this->value) && $this->value[0])
return $this->value;
elseif (is_array($this->raw) && $this->raw[0])
return $this->raw;

return array($this->default);
}

public static function stringToTimeList($string)
{
$list = array();
Expand All @@ -86,4 +99,4 @@ public function exportValue()
throw new UnimplementedFeatureException();
}
}
?>
?>