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

gen_custom_fields_html_props()

Description

Generate HTML properties for custom fields. These properties can then be used by other functions
like render_custom_fields or process_custom_fields_submission

assumes fields have been validated

Parameters

ColumnTypeDefaultDescription
$fields array List of custom fields as returned by get_valid_custom_fields(). Note: At this point code

Return

array Returns collection items with the extra "html_properties" key

Location

include/request_functions.php lines 1125 to 1135

Definition

 
function gen_custom_fields_html_props(array $fields)
    {
    return 
array_map(function($field)
        {
        
$field["html_properties"] = array(
            
"id"   => "custom_field_{$field["id"]}",
            
"name" => (!empty($field["options"]) ? "custom_field_{$field["id"]}[]" "custom_field_{$field["id"]}"),
        );
        return 
$field;
        }, 
$fields);
    }

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 27th September 2024 12:30 Europe/London time.