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

process_edit_form()

Parameters

ColumnTypeDefaultDescription
$ref
$resource

Location

include/resource_functions.php lines 6662 to 6717

Definition

 
function process_edit_form($ref$resource)
{
    global 
$multiple$lang$embedded_data_user_select$embedded_data_user_select_fields$data_only_resource_types,
    
$check_edit_checksums$uploadparams$relate_on_upload$enable_related_resources,
    
$is_template$upload_collection_name_required$upload_review_mode$userref$userref$collection_add$baseurl_short,
    
$no_exif$autorotate;

    
# save data
    # When auto saving, pass forward the field so only this is saved.
    
$autosave_field getval("autosave_field""");

    
# Upload template: Change resource type
    
$resource_type getval("resource_type""");
    if (
$resource_type != "" && $resource_type != $resource["resource_type"] && !checkperm("XU{$resource_type}") && $autosave_field == "") {     // only if resource type specified and user has permission for that resource type
        // Check if resource type has been changed between form being loaded and submitted
        
$post_cs getval("resource_type_checksum""");
        
$current_cs $resource["resource_type"];
        if (
$check_edit_checksums && $post_cs != "" && $post_cs != $current_cs) {
            
$save_errors = array("resource_type" => $lang["resourcetype"] . ": " $lang["save-conflict-error"]);
        } else {
            
update_resource_type($ref$resource_type);
            
$previous_resource_type $resource["resource_type"];
        }
    }
    
$resource get_resource_data($reffalse); # Reload resource data.

    
if (!in_array($resource['resource_type'], $data_only_resource_types)) {
        unset(
$uploadparams['forcesingle']);
        unset(
$uploadparams['noupload']);
    }
    if (!isset(
$save_errors)) {
        
# Perform the save
        
$save_errors save_resource_data($ref$multiple$autosave_field);
    }

    if (isset(
$previous_resource_type) && !$multiple && $upload_review_mode) {
        
apply_resource_default((int) $previous_resource_type, (int) $resource_type, (int) $ref);
    }

    if (
$relate_on_upload && $enable_related_resources && getval("relateonupload""") != "") {
        
$uploadparams['relateonupload'] = 'yes';
    }

    if (
        
$upload_collection_name_required
        
&& getval("entercolname""") == ""
        
&& getval("collection_add""") == "new"
    
) {
        if (!
is_array($save_errors)) {
            
$save_errors = array();
        }
            
$save_errors['collectionname'] = $lang["collectionname"] . ": " $lang["requiredfield"];
    }

    return 
$save_errors;
}

This article was last updated 15th February 2025 20:35 Europe/London time based on the source file dated 14th February 2025 12:25 Europe/London time.