fix: skipping metadata childre if the metadata coumpound is disabled #688

This commit is contained in:
vnmedeiros 2022-08-16 16:35:00 -03:00
parent 4bbc958d3a
commit 8c7d7f5e9c
1 changed files with 8 additions and 0 deletions

View File

@ -705,6 +705,14 @@ class Metadata extends Repository {
$result_ordinate[ $index ] = $item;
} else {
// skipping if metadata coumpound is disabled if the arg is set
if ($item->get_parent() > 0) {
$parent_metadatum = new \Tainacan\Entities\Metadatum($item->get_parent());
$parent_index = array_search( $parent_metadatum->get_id(), array_column( $order, 'id' ) );
if ( ! $include_disabled && (!$enabled_metadata_section || isset( $order[ $parent_index ]['enabled'] ) && ! $order[ $parent_index ]['enabled'] )) {
continue;
}
}
$not_ordinate[] = $item;
}
}