Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 1130 to 1140

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 19th March 2024 02:05 Europe/London time based on the source file dated 28th February 2024 10:20 Europe/London time.