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

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 1023 to 1044

Definition

 
function render_dropdown_option($value$label, array $data_attr = array(), $extra_tag_attributes  '')
    {
    
$result '<option value="' escape($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 .= '>' escape($label) . '</option>';

    return 
$result;
    }

This article was last updated 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 14:05 Europe/London time.