Merge branch 'release/0.16' of https://github.com/tainacan/tainacan into release/0.16
This commit is contained in:
commit
0ee6b31240
|
@ -71,7 +71,7 @@ class Item_Metadata extends Repository {
|
|||
} else {
|
||||
if ( $unique ) {
|
||||
if( empty( $item_metadata->get_value() ) ) {
|
||||
delete_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id() );
|
||||
delete_metadata_by_mid( 'post', $item_metadata->get_meta_id() );
|
||||
} elseif ( is_int( $item_metadata->get_meta_id() ) ) {
|
||||
update_metadata_by_mid( 'post', $item_metadata->get_meta_id(), wp_slash( $item_metadata->get_value() ) );
|
||||
} else {
|
||||
|
|
|
@ -175,54 +175,30 @@ class Compound extends Metadata_Type {
|
|||
return $return;
|
||||
|
||||
if ( $item_metadata->is_multiple() ) {
|
||||
|
||||
if ( sizeof($value) > 0 ) {
|
||||
|
||||
$return .= '<div class="tainacan-compound-group">';
|
||||
$count = 0;
|
||||
|
||||
$elements = [];
|
||||
foreach ( $value as $compound_element ) {
|
||||
$count++;
|
||||
|
||||
if ( sizeof($compound_element) > 0 ) {
|
||||
|
||||
$return .= '<div class="tainacan-compound-metadatum">';
|
||||
|
||||
if ( !empty($compound_element) ) {
|
||||
$metadata_value = '';
|
||||
foreach ( $compound_element as $meta ) {
|
||||
if ( $meta instanceof Item_Metadata_Entity && $meta->get_value_as_html() != '' ) {
|
||||
$return .= '<label class="label">' . $meta->get_metadatum()->get_name() . "</label>\n";
|
||||
$return .= '<p>' . $meta->get_value_as_html() . '</p>' . "\n\n";
|
||||
$metadata_value .= '<label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p> \n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($count < sizeof($compound_element)) {
|
||||
$return .= '</div>' . "\n" . $separator . "\n";
|
||||
} else {
|
||||
$return .= '</div>';
|
||||
$elements[] = '<div class="tainacan-compound-metadatum">' . $metadata_value . "</div> \n" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return .= '</div>' . "\n\n";
|
||||
}
|
||||
|
||||
$return .= '<div class="tainacan-compound-group">' . implode($separator, $elements) . '</div>';
|
||||
} else {
|
||||
$return .= '<div class="tainacan-compound-group">';
|
||||
|
||||
foreach ( $value as $meta ) {
|
||||
|
||||
if ( $meta->get_value_as_html() != '' ) {
|
||||
|
||||
$return .= '<div class="tainacan-metadatum">';
|
||||
|
||||
if ( $meta instanceof Item_Metadata_Entity ) {
|
||||
$return .= '<label class="label">' . $meta->get_metadatum()->get_name() . "</label>\n";
|
||||
$return .= '<p>' . $meta->get_value_as_html() . '</p>';
|
||||
}
|
||||
|
||||
$return .= '</div>' . "\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
$return .= '</div>' . "\n\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue