save metadata multiple value as array in logs #261
This commit is contained in:
parent
a2795e2442
commit
54221042b5
|
@ -443,11 +443,15 @@ class Logs extends Repository {
|
||||||
|
|
||||||
$old = new Entities\Item_Metadata_Entity($unsaved->get_item(), $unsaved->get_metadatum());
|
$old = new Entities\Item_Metadata_Entity($unsaved->get_item(), $unsaved->get_metadatum());
|
||||||
|
|
||||||
|
add_filter('tainacan-item-metadata-get-multivalue-separator', [$this, '__temporary_multivalue_separator']);
|
||||||
|
|
||||||
if ( $old instanceof Entities\Item_Metadata_Entity ) {
|
if ( $old instanceof Entities\Item_Metadata_Entity ) {
|
||||||
$diff['old'] = $old->get_value_as_string();
|
$diff['old'] = \explode($this->__temporary_multivalue_separator(''), $old->get_value_as_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
$diff['new'] = $unsaved->get_value_as_string();
|
$diff['new'] = \explode($this->__temporary_multivalue_separator(''), $unsaved->get_value_as_string());
|
||||||
|
|
||||||
|
remove_filter('tainacan-item-metadata-get-multivalue-separator', [$this, '__temporary_multivalue_separator']);
|
||||||
|
|
||||||
$diff = apply_filters( 'tainacan-entity-diff', $diff, $unsaved, $old );
|
$diff = apply_filters( 'tainacan-entity-diff', $diff, $unsaved, $old );
|
||||||
|
|
||||||
|
@ -456,6 +460,10 @@ class Logs extends Repository {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __temporary_multivalue_separator($sep) {
|
||||||
|
return '--xx--';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback to generate log when Tainacan entities are edited
|
* Callback to generate log when Tainacan entities are edited
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue