(mvc) regression, fix validation issue on arrayfields children

This commit is contained in:
Ad Schellevis 2015-07-02 16:16:39 +02:00
parent d26c14a035
commit 6c02d112f8
2 changed files with 12 additions and 3 deletions

View File

@ -84,6 +84,7 @@ class ArrayField extends BaseField
// initialize field with new internal id and defined default value
$node->setInternalReference($container_node->__reference.".".$key);
$node->applyDefault();
$node->setChanged();
$container_node->addChildNode($key, $node);
}

View File

@ -256,6 +256,14 @@ abstract class BaseField
$this->internalValue = $value;
}
/**
* force field to act as changed, used after cloning.
*/
public function setChanged()
{
$this->internalInitialValue = true;
}
/**
* check if field content has changed
* @return bool change indicator
@ -452,16 +460,16 @@ abstract class BaseField
*/
public function setDefault($value)
{
$this->internalValue = $value;
$this->internalDefaultValue = $value;
$this->setValue($value);
}
/**
* (re)Apply default value
* (re)Apply default value without changing the initial value of the field
*/
public function applyDefault()
{
$this->setValue($this->internalDefaultValue);
$this->internalValue = $this->internalDefaultValue;
}
/**