diff --git a/src/Resources/config/form_extensions/edit.yml b/src/Resources/config/form_extensions/edit.yml index e4841e3..11d1423 100644 --- a/src/Resources/config/form_extensions/edit.yml +++ b/src/Resources/config/form_extensions/edit.yml @@ -22,7 +22,8 @@ extensions: config: labels: title: flagbit.confirmation.clone.product - subTitle: pim_menu.item.product_model + subTitle: pim_enrich.entity.product.label + subTitleModel: pim_menu.item.product_model content: confirmation.clone.product successMessage: flagbit.entity.product.info.create_successful postProductRoute: flagbit_product_cloner_product_clone diff --git a/src/Resources/public/js/product/form/clone-modal.js b/src/Resources/public/js/product/form/clone-modal.js index f381297..07daeb0 100644 --- a/src/Resources/public/js/product/form/clone-modal.js +++ b/src/Resources/public/js/product/form/clone-modal.js @@ -51,9 +51,11 @@ define( }, render() { + + this.$el.html(this.template({ modalTitle: __(this.config.labels.title), - subTitle: __(this.config.labels.subTitle), + subTitle: __(this.getSubtitle()), content: __(this.config.labels.content), picture: this.config.picture, errors: this.globalErrors @@ -72,6 +74,28 @@ define( }); }, + getIllustrationClass() { + if (this.getProductType() == 'model') { + return 'product-model'; + } + else { + return 'products'; + } + }, + + getSubtitle() { + if (this.getProductType() == 'model') { + return this.config.labels.subTitleModel; + } + else { + return this.config.labels.subTitle; + } + }, + + getProductType() { + return this.getRoot().model.get('type'); + }, + /** * Opens the modal then instantiates the creation form inside it. * This function returns a rejected promise when the popin @@ -86,7 +110,8 @@ define( content: '', cancelText: __('pim_common.cancel'), okText: __('pim_common.save'), - okCloses: false + okCloses: false, + illustrationClass: this.getIllustrationClass() }); modal.open();