Enqueues extra metadata type components on item submission block.

This commit is contained in:
mateuswetah 2020-11-16 17:44:17 -03:00
parent 6741a67fce
commit d1dbfcb50c
2 changed files with 8 additions and 2 deletions

View File

@ -178,7 +178,7 @@
if (this.itemMetadatum.value !== null) {
// This routine avoids calling the API if the value did not changed
// This routine avoids calling the API if the value did not changed
switch(this.itemMetadatum.value.constructor.name) {
// Multivalored Metadata requires checking the whole array
@ -202,7 +202,7 @@
if (equal.length == currentValues.length && this.itemMetadatum.value.length <= equal.length)
return;
} else {
} else { // This will happen in taxonomy single valued on item submission, as there all term values appear as array.
if (this.itemMetadatum.value == currentValues)
return;
}

View File

@ -178,6 +178,7 @@ function tainacan_blocks_register_tainacan_item_submission_form(){
array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
);
// Registers Google ReCAPTCHA
wp_register_script(
'google-recaptcha-script',
'https://www.google.com/recaptcha/api.js',
@ -185,6 +186,11 @@ function tainacan_blocks_register_tainacan_item_submission_form(){
);
wp_enqueue_script('google-recaptcha-script');
// Registers extra metadata type forms
$theme_helper = \Tainacan\Metadata_Types\Metadata_Type_Helper::get_instance();
if (isset($theme_helper))
$theme_helper->register_metadata_type_compoment();
wp_register_style(
'item-submission-form',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-item-submission-form.css',