diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index aa42fc978..6285a1bae 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -945,7 +945,20 @@ export default { }, shouldDisplayItemEditionAttachments() { return !this.$adminOptions.hideItemEditionAttachments && (this.collection && this.collection.item_enable_attachments === 'yes'); - } + }, + hasRedirectHook() { + if (wp !== undefined && wp.hooks !== undefined) + return wp.hooks.hasFilter(`tainacan_item_edition_after_update_redirect`); + + return false; + }, + getRedirectHook() { + const itemViewURL = tainacan_plugin.admin_url + '?page=tainacan_admin#' + this.$routerHelper.getItemPath(this.form.collectionId, this.itemId); + if (wp !== undefined && wp.hooks !== undefined) + return wp.hooks.applyFilters(`tainacan_item_edition_after_update_redirect`, itemViewURL, this.form, this.itemId); + + return itemViewURL; + }, }, watch: { '$route.params.itemPosition'(newItemPosition, oldItemPosition) { @@ -1194,13 +1207,17 @@ export default { if (!this.$adminOptions.itemEditionMode && !this.$adminOptions.mobileAppMode) { if (!this.isOnSequenceEdit) { - if (this.form.status != 'trash') { - if (previousStatus == 'auto-draft') - this.$router.push({ path: this.$routerHelper.getItemPath(this.form.collectionId, this.itemId), query: { recent: true } }); - else - this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId)); - } else - this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId)); + if ( this.hasRedirectHook ) { + window.location.replace( this.getRedirectHook ); + } else { + if (this.form.status != 'trash') { + if (previousStatus == 'auto-draft') + this.$router.push({ path: this.$routerHelper.getItemPath(this.form.collectionId, this.itemId), query: { recent: true } }); + else + this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId)); + } else + this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId)); + } } else { if (sequenceDirection == 'next') this.onNextInSequence();