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_archive_required_fields_check()

Description

Considers if checking of missed required fields is required when a resource changes archive state. We'll always allow moving
to the $resource_deletion_state and Pending Submission state (-2). Exceptions made to archive states in rse_workflow will be applied.
Return will consist of an empty array where no checking is needed or an array of metadata field data where the field is required
but was not completed.

Parameters

ColumnTypeDefaultDescription
$resource int|array Resource ref or array of resource data, likely from get_resource_data().
$archive_state: int
$archive_state int Destination archive state.

Location

include/metadata_functions.php lines 429 to 463

Definition

 
function update_archive_required_fields_check(int|array $resourceint $archive_state): array
{
    global 
$resource_deletion_state;

    if (
is_array($resource)) {
        
$resource_ref $resource['ref'];
    } else {
        
$resource_ref $resource;
    }

    if (isset(
$GLOBALS['update_archive_required_fields_check'][$resource_ref])) {
        return 
$GLOBALS['update_archive_required_fields_check'][$resource_ref];
    }

    if (
in_array($archive_state, array(-2$resource_deletion_state))) {
        
# No check required moving to these archive states.
        
return array();
    }

    if (!isset(
$GLOBALS['update_archive_required_fields_check_hook'][$archive_state])) {
        
$check_not_required hook(('archive_skip_required_fields'), '', array($archive_state));
        
$GLOBALS['update_archive_required_fields_check_hook'][$archive_state] = $check_not_required;
    } else {
        
$check_not_required $GLOBALS['update_archive_required_fields_check_hook'][$archive_state];
    }

    if (
$check_not_required) {
        
# Workflow states destination archive allows for required fields checking to be skipped.
        
return array();
    }

    
$result missing_fields_check($resource);
    
$GLOBALS['update_archive_required_fields_check'][$resource_ref] = $result;
    return 
$result;
}

This article was last updated 31st July 2025 11:35 Europe/London time based on the source file dated 30th July 2025 15:15 Europe/London time.