Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource 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 1109 to 1119

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 24th November 2020 05:35 Europe/London time based on the source file dated 28th September 2020 10:05 Europe/London time.