Add action to extenders perform something when the item edition page finishes loading item and metadata.

This commit is contained in:
mateuswetah 2024-05-17 09:27:04 -03:00
parent 195a122291
commit 4f4091d5aa
1 changed files with 9 additions and 0 deletions

View File

@ -1327,6 +1327,9 @@ export default {
});
}
if ( this.collection && this.item )
wp.hooks.doAction('tainacan_item_edition_item_loaded', JSON.parse(JSON.stringify(this.collection)), JSON.parse(JSON.stringify(this.item)));
// Loads metadata and attachments
this.loadMetadata();
@ -1367,6 +1370,9 @@ export default {
this.conditionalSections[conditionalSectionId].hide = Array.isArray(itemMetadatumValues) ? itemMetadatumValues.every(aValue => conditionalValues.indexOf(aValue['id'] ? aValue['id'] : aValue) < 0) : conditionalValues.indexOf(itemMetadatumValues) < 0;
}
}
if ( this.collection && this.item && metadata)
wp.hooks.doAction('tainacan_item_edition_metadata_loaded', JSON.parse(JSON.stringify(this.collection)), JSON.parse(JSON.stringify(this.item)), metadata);
this.isLoading = false;
});
@ -1765,6 +1771,9 @@ export default {
if (this.form.document_options !== undefined && this.form.document_options['forced_iframe_height'] !== undefined)
this.urlIframeHeight = this.form.document_options['forced_iframe_height'];
if ( this.collection && this.item )
wp.hooks.doAction('tainacan_item_edition_item_loaded', JSON.parse(JSON.stringify(this.collection)), JSON.parse(JSON.stringify(this.item)));
this.loadMetadata();
this.setLastUpdated(this.item.modification_date);