BP_Admin_Tab::render_select_field_html( $args )

Output the select field html based on the arguments

Description

Source

File: bp-core/classes/class-bp-admin-tab.php

	public function render_select_field_html( $args ) {
		$input_value = is_null( $args['input_value'] )? $args['input_default'] : $args['input_value'];
		$input_name = $args['input_name'];

        printf(
        	'<select name="%s" id="%s" autocomplete="off" %s>',
        	$args['input_name'],
        	$args['input_id'],
			$args['input_run_js']? "data-run-js-condition=\"{$args['input_run_js']}\"" : ''
        );

        foreach ($args['input_options'] ?: [] as $key => $value) {
        	$selected = $input_value == $key? 'selected' : '';
        	printf( '<option value="%s" %s>%s</option>', $key, $selected, $value );
        }

        echo '</select>';

        if ( $args['input_description'] ) {
			echo $this->render_input_description($args['input_description']);
        }
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.