Creates redirection filter for item edition save button.
This commit is contained in:
parent
52d52f5868
commit
283c877ce8
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue