Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Inventory_Presser_Admin_Options::html_select_vehicle_keys( array $attributes = null, string $selected_value = null )

Get a list of all the post meta keys in our CPT. Let the user choose one as a default sort.


Parameters Parameters

$attributes

(array) (Optional)

Default value: null

$selected_value

(string) (Optional)

Default value: null


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/admin/class-admin-options.php

	private function html_select_vehicle_keys( $attributes = null, $selected_value = null ) {
		$options = '<option value="">' . esc_html__( 'No filter', 'inventory-presser' ) . '</option>';
		foreach ( INVP::keys( false ) as $key ) {
			$meta_key = apply_filters( 'invp_prefix_meta_key', $key );

			// Skip hidden post meta keys.
			if ( '_' === $meta_key[0] ) {
				continue;
			}

			$value = apply_filters( 'invp_html_select_vehicle_keys_value', $key );

			$options .= sprintf(
				'<option value="%s"%s>%s</option>',
				$value,
				selected( $selected_value, $value, false ),
				str_replace( '_', ' ', ucfirst( $key ) )
			);
		}

		$attribute_string = '';
		if ( ! empty( $attributes ) ) {
			$attribute_string = ' ' . str_replace( '=', '="', http_build_query( $attributes, '', '" ', PHP_QUERY_RFC3986 ) ) . '"';
		}

		return sprintf(
			'<select%s>%s</select>',
			urldecode( $attribute_string ),
			$options
		);
	}