0) ) { $configured_resource_type_tabs = ps_array( "SELECT DISTINCT t.ref AS `value` FROM resource_type AS rt INNER JOIN tab AS t ON t.ref = rt.tab WHERE rt.ref IN(" . ps_param_insert(count($related_type_show_with_data)) . ") AND rt.ref <> ?;", array_merge(ps_param_fill($related_type_show_with_data, 'i'), ['i', $resource['resource_type']]), 'schema' ); } // Clean the tabs by removing the ones that would end up being empty foreach (array_keys($system_tabs) as $tab_ref) { // Always keep the Resource type tabs if configured so if (in_array($tab_ref, $configured_resource_type_tabs)) { // Related resources can be rendered in tabs shown alongside the regular data tabs instead of in their usual position lower down the page $tabs_fields_assoc[$tab_ref] = []; continue; } for ($i = 0; $i < count($fields); ++$i) { $fields[$i]['tab'] = (int) $fields[$i]['tab']; $field_can_show_on_tab = ( $fields[$i]['display_field'] == 1 && $fields[$i]['value'] != '' && $fields[$i]['value'] != ',' && ($access == 0 || ($access == 1 && !$fields[$i]['hide_when_restricted'])) && ($displaycheck[$fields[$i]["ref"]] ?? false) ); // Check if the field can show on this tab if ($tab_ref > 0 && $tab_ref == $fields[$i]['tab'] && $field_can_show_on_tab) { $tabs_fields_assoc[$tab_ref][$i] = $fields[$i]['ref']; $disable_tabs = false; } // Unassigned or invalid tab links end up on the "not set" list (IF they will be rendered) elseif ( !isset($tabs_fields_assoc[0][$i]) && (0 === $fields[$i]['tab'] || !isset($system_tabs[$fields[$i]['tab']])) && $field_can_show_on_tab ) { $tabs_fields_assoc[0][$i] = $fields[$i]['ref']; } } } // System is configured with tabs once at least a field has been associated with a valid tab and the field will be rendered if ($disable_tabs) { $tabs_fields_assoc = []; } elseif (isset($tabs_fields_assoc[0]) && count($tabs_fields_assoc[0]) > 0) { foreach (array_keys($tabs_fields_assoc[0]) as $i) { $fields[$i]['tab'] = 1; } // Any fields marked as "not set" get placed in the Default (ref #1) tab $tabs_fields_assoc[1] = $tabs_fields_assoc[0]; unset($tabs_fields_assoc[0]); } $fields_tab_names = array_intersect_key($system_tabs, $tabs_fields_assoc); debug(sprintf('$fields_tab_names = %s', json_encode($fields_tab_names))); // ----------------------- END: Tab calculation ----------------- ?>

$udata["ref"]]); $udata_a_tag = sprintf( '%s', $udata_a_tag_href, $udata_fullname ); ?>

0) { ?>
tabswitch" class="Tab">
" id="" >
$tabname) { for ($i = 0; $i < count($fields); $i++) { if ( ( $fields[$i]["global"] == 1 || in_array($resource['resource_type'], $arr_fieldrestypes[$fields[$i]['ref']]) || ( isset($metadata_template_resource_type) && $resource['resource_type'] == $metadata_template_resource_type ) ) && ($displaycheck[$fields[$i]["ref"]] ?? false) && $tab_ref == $fields[$i]['tab'] && !hook('renderfield', '', array($fields[$i], $resource)) ) { display_field_data($fields[$i]); } } // Fields without templates which are linked to the in-process tab have now all been rendered // Those with templates which are linked to the in-process tab have had their markup appended to $extra // Show related resources which have the in-process tab name: include '../include/related_resources.php'; // Now render any markup previously sidelined in $extra (eg. fields with a display template) ?>