Fixes to handling of taxonomy metadata value in conditional sections.
This commit is contained in:
parent
7ff1353e1a
commit
b960848b23
|
@ -1184,17 +1184,26 @@ class Item extends Entity {
|
|||
|
||||
if ( $metadata_section->is_conditional_section() ) {
|
||||
$rules = $metadata_section->get_conditional_section_rules();
|
||||
|
||||
if ( !empty($rules) ) {
|
||||
foreach ( $rules as $meta_id => $meta_values_conditional ) {
|
||||
$meta_values = [];
|
||||
$metadatum = new \Tainacan\Entities\Metadatum($meta_id);
|
||||
$metadatum_type = $metadatum->get_metadata_type_object();
|
||||
|
||||
if ( $metadatum_type->get_primitive_type() == 'term' ) {
|
||||
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($this, $metadatum);
|
||||
$term_values = $metadatum->is_multiple() ? $item_metadata->get_value() : array( $item_metadata->get_value() );
|
||||
$meta_values = array_map(function($term) {
|
||||
return $term->get_id();
|
||||
}, $term_values);
|
||||
|
||||
if ( $metadatum->is_multiple() ) {
|
||||
$term_values = $item_metadata->get_value();
|
||||
$meta_values = array_map(function($term) {
|
||||
return $term->get_id();
|
||||
}, $term_values);
|
||||
} else {
|
||||
$term_values = $item_metadata->get_value();
|
||||
$meta_values = $term_values == false ? [] : $term_values;
|
||||
}
|
||||
|
||||
} else {
|
||||
$item_id = $this->get_id();
|
||||
$meta_values = get_post_meta( $item_id, $meta_id );
|
||||
|
|
|
@ -397,7 +397,7 @@
|
|||
<i class="tainacan-icon tainacan-icon-metadata" />
|
||||
</span>
|
||||
<span
|
||||
v-if="metadataSections.length > 1 && collection.item_enable_metadata_enumeration === 'yes'"
|
||||
v-if="metadataSections.length > 1 && collection && collection.item_enable_metadata_enumeration === 'yes'"
|
||||
style="opacity: 0.65;"
|
||||
class="metadata-section-enumeration">
|
||||
{{ Number(sectionIndex) + 1 }}.
|
||||
|
@ -443,7 +443,7 @@
|
|||
:hide-help-buttons="false"
|
||||
:help-info-bellow-label="false"
|
||||
:is-mobile-screen="isMobileScreen"
|
||||
:enumerate-metadatum="metadataSections.length > 1 && collection.item_enable_metadata_enumeration === 'yes' ? ( (Number(sectionIndex) + 1) + '.' + (Number(getMetadatumOrderInSection(sectionIndex, itemMetadatum.metadatum)) + 1) ) : false"
|
||||
:enumerate-metadatum="metadataSections.length > 1 && collection && collection.item_enable_metadata_enumeration === 'yes' ? ( (Number(sectionIndex) + 1) + '.' + (Number(getMetadatumOrderInSection(sectionIndex, itemMetadatum.metadatum)) + 1) ) : false"
|
||||
:is-last-metadatum="index > 2 && (index == itemMetadata.length - 1)"
|
||||
:is-focused="focusedMetadatum === index"
|
||||
:is-metadata-navigation="isMetadataNavigation"
|
||||
|
@ -671,7 +671,7 @@
|
|||
<template v-else>
|
||||
<span
|
||||
v-if="form.status === 'auto-draft'"
|
||||
class="has-text-danger">
|
||||
class="has-text-warning">
|
||||
{{ $i18n.get('info_autodraft_updated') }}
|
||||
</span>
|
||||
<span v-else>
|
||||
|
|
Loading…
Reference in New Issue