Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

render_dropdown_option()

Description

Renders a dropdown option

Parameters

ColumnTypeDefaultDescription
$value
$label
$data_attr array array
$extra_tag_attributes ''

Location

include/render_functions.php lines 812 to 833

Definition

 
function render_dropdown_option($value$label, array $data_attr = array(), $extra_tag_attributes  '')
    {
    
$result '<option value="' $value '"';

    
// Add any extra tag attributes
    
if(trim($extra_tag_attributes) !== '')
        {
        
$result .= ' ' $extra_tag_attributes;
        }

    
// Add any data attributes you may need
    
foreach($data_attr as $data_attr_key => $data_attr_value)
        {
        
$data_attr_key str_replace(' ''_'$data_attr_key);

        
$result .= ' data-' $data_attr_key '="' $data_attr_value '"';
        }

    
$result .= '>' $label '</option>';

    return 
$result;
    }

This article was last updated 23rd November 2020 16:35 Europe/London time based on the source file dated 13th November 2020 15:00 Europe/London time.