Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

update_resource_type_field_resource_types()

Description

Update the resource_type_field - resource_type mappings

Parameters

ColumnTypeDefaultDescription
$ref int Resource type field ref
$resource_types array Array of resource type refs

Return

void *

Location

include/config_functions.php lines 1643 to 1658

Definition

 
function update_resource_type_field_resource_types(int $ref, array $resource_types)
{
    
ps_query("DELETE FROM resource_type_field_resource_type WHERE resource_type_field = ?", ["i",$ref]);

    if (
in_array(0$resource_types)) {
        
// Global field, cannot have specific fields assigned
        
ps_query("UPDATE resource_type_field SET global=1 WHERE ref = ?", ["i",$ref]);
    } elseif (
count($resource_types) > 0) {
        
$query "INSERT INTO resource_type_field_resource_type (resource_type_field, resource_type) VALUES ";
        
$valuestring "(" . (int)$ref . (str_repeat(",?),(" $refcount($resource_types) - 1)) . ",?)";
        
ps_query($query $valuestringps_param_fill($resource_types"i"));
        
ps_query("UPDATE resource_type_field SET global=0 WHERE ref = ?", ["i",$ref]);
    }

    
clear_query_cache("schema");
}

This article was last updated 5th July 2025 16:35 Europe/London time based on the source file dated 4th July 2025 10:35 Europe/London time.