src/Forms/Fields/Types/CollectionType.php
public function metaboxSave($value, int $post_id)
    {
        $this->setValue($value);

        $previous = get_post_meta($post_id, $this->getName(), false);

        if (is_null($value) || empty($value)) {
            delete_post_meta($post_id, $this->getName());
        } elseif (empty($previous) && is_array($value)) {
            array_walk($value, function ($val) use ($post_id) {
                add_post_meta($post_id, $this->getName(), $val, false);
            });
        } else {
            delete_post_meta($post_id, $this->getName());

            array_walk($value, function ($val) use ($post_id, $previous) {
                add_post_meta($post_id, $this->getName(), $val, false);
            });
        }
    }
public function metaboxSave($value, int $post_id)
    {
        $this->setValue($value);

        $previous = get_post_meta($post_id, $this->getName(), false);

        if (is_null($value) || empty($value)) {
            delete_post_meta($post_id, $this->getName());
        } elseif (empty($previous) && is_array($value)) {
            array_walk($value, function ($val) use ($post_id) {
                add_post_meta($post_id, $this->getName(), $val, false);
            });
        } else {
            delete_post_meta($post_id, $this->getName());

            array_walk($value, function ($val) use ($post_id, $previous) {
                add_post_meta($post_id, $this->getName(), $val, false);
            });
        }
    }
public function metaboxSave ( $ value , int $ post_id ) { $ this -> setValue ( $ value ) ; $ previous = get_post_meta ( $ post_id , $ this -> getName ( ) , false ) ; if ( is_null ( $ value ) || empty ( $ value ) ) { delete_post_meta ( $ post_id , $ this -> getName ( ) ) ; } elseif ( empty ( $ previous ) && is_array ( $ value ) ) { array_walk ( $ value , function ( $ val ) use ( $ post_id ) { add_post_meta ( $ post_id , $ this -> getName ( ) , $ val , false ) ; } ) ; } else { delete_post_meta ( $ post_id , $ this -> getName ( ) ) ; array_walk ( $ value , function ( $ val ) use ( $ post_id , $ previous ) { add_post_meta ( $ post_id , $ this -> getName ( ) , $ val , false ) ; } ) ; } }
Handle collection field post meta registration.

@param array $value
@param int   $post_id
Handle collection field post meta registration .