wordpress/wp-content/themes/basic/themify/themify-metabox/includes/themify-field-types.php
/**
 * Generates select field
 *
 * @param array $args Field settings
 *
 * @since 1.3.2
 * @return string
 */
Generates select field
@param array $args Field settings


Generates select field @param array $args Field settings
function themify_meta_field_dropdown( $args ) {
	$meta_box = $args['meta_box'];
	$meta_value = $args['meta_value'];
	extract($args, EXTR_OVERWRITE);
	$ops_html = '';
	if( is_callable( $meta_box['meta'] ) ) {
		$meta_box['meta'] = call_user_func( $meta_box['meta'] );
	}
	foreach($meta_box['meta'] as $option){
		$ops_html .= sprintf('<option value="%s" %s>%s</option>',
			esc_attr( $option['value'] ),
			isset( $meta_value ) && '' != $meta_value? selected( $meta_value, esc_attr( $option['value'] ), false )
				: selected( isset( $option['selected'] )? $option['selected'] : '', true, false ),
			esc_html( $option['name'] )
		);
	}
	$html = sprintf('<select id="%s" name="%s">%s</select>',
		esc_attr( $meta_box['name'] ), esc_attr( $meta_box['name'] ), $ops_html);
	$html = themify_meta_field_get_label($html, $meta_box);
	$html .= isset( $meta_box['description'] )? themify_meta_field_get_description($meta_box['description']) : '';
	if( isset( $meta_box['before'] ) && $meta_box['before'] ) $html = $meta_box['before'] . $html;
	if( isset( $meta_box['after'] ) && $meta_box['after'] )  $html .= $meta_box['after'];
	echo $html;
}
function themify_meta_field_dropdown ( $ args ) { $ meta_box = $ args [ 'meta_box' ] ; $ meta_value = $ args [ 'meta_value' ] ; extract ( $ args , EXTR_OVERWRITE ) ; $ ops_html = '' ; if ( is_callable ( $ meta_box [ 'meta' ] ) ) { $ meta_box [ 'meta' ] = call_user_func ( $ meta_box [ 'meta' ] ) ; } foreach ( $ meta_box [ 'meta' ] as $ option ) { $ ops_html .= sprintf ( '<option value="%s" %s>%s</option>' , esc_attr ( $ option [ 'value' ] ) , isset ( $ meta_value ) && '' != $ meta_value ? selected ( $ meta_value , esc_attr ( $ option [ 'value' ] ) , false ) : selected ( isset ( $ option [ 'selected' ] ) ? $ option [ 'selected' ] : '' , true , false ) , esc_html ( $ option [ 'name' ] ) ) ; } $ html = sprintf ( '<select id="%s" name="%s">%s</select>' , esc_attr ( $ meta_box [ 'name' ] ) , esc_attr ( $ meta_box [ 'name' ] ) , $ ops_html ) ; $ html = themify_meta_field_get_label ( $ html , $ meta_box ) ; $ html .= isset ( $ meta_box [ 'description' ] ) ? themify_meta_field_get_description ( $ meta_box [ 'description' ] ) : '' ; if ( isset ( $ meta_box [ 'before' ] ) && $ meta_box [ 'before' ] ) $ html = $ meta_box [ 'before' ] . $ html ; if ( isset ( $ meta_box [ 'after' ] ) && $ meta_box [ 'after' ] ) $ html .= $ meta_box [ 'after' ] ; echo $ html ; }
Generates select field
 @param array $args Field settings
Generates select field @param array $args Field settings
/* dynamic data source, call a function to populate the field */