mirror of
https://github.com/getgrav/grav.git
synced 2026-02-17 03:58:12 +01:00
Fixed partial save for Flex Objects
This commit is contained in:
@@ -116,15 +116,18 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
|
||||
*/
|
||||
public function update(array $data, $isFullUpdate = false)
|
||||
{
|
||||
// Validate and filter the incoming data.
|
||||
$blueprint = $this->getFlexDirectory()->getBlueprint();
|
||||
$blueprint->validate($data + ['storage_key' => $this->getStorageKey(), 'timestamp' => $this->getTimestamp()]);
|
||||
$data = $blueprint->filter($data);
|
||||
|
||||
if (!$isFullUpdate) {
|
||||
// Partial update: merge data to the existing object.
|
||||
$elements = $this->getElements();
|
||||
$data = $blueprint->mergeData($elements, $data);
|
||||
}
|
||||
|
||||
$blueprint->validate($data + ['storage_key' => $this->getStorageKey()]);
|
||||
$data = $blueprint->filter($data);
|
||||
// Filter object data.
|
||||
$this->filterElements($data);
|
||||
|
||||
if ($data) {
|
||||
|
||||
Reference in New Issue
Block a user