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_operator( array $attributes = null, string $selected_value = null )

Creates a dropdown select that contains logical operators.


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_operator( $attributes = null, $selected_value = null ) {
		$keys = array(
			__( 'exists', 'inventory-presser' ),
			__( 'does not exist', 'inventory-presser' ),
			__( 'greater than', 'inventory-presser' ),
			__( 'less than', 'inventory-presser' ),
			__( 'equal to', 'inventory-presser' ),
			__( 'not equal to', 'inventory-presser' ),
			__( 'contains', 'inventory-presser' ),
		);

		$options = '';
		foreach ( $keys as $key ) {
			$slug     = str_replace( ' ', '_', $key );
			$options .= sprintf(
				'<option value="%s"%s>%s</option>',
				$slug,
				selected( $selected_value, $slug, false ),
				$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
		);
	}