Automattic\WooCommerce\Blocks\BlockTypes

Dropdown::get_option_text │ private │ WC 1.0

Plain-text label for a select option (no HTML in <option>).

Метод класса: Dropdown{}

Хуков нет.

Возвращает

string.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_option_text( $item ): string;
$item(массив) (обязательный)
Selectable item from context.

Код Dropdown::get_option_text() WC 11.3.0

private function get_option_text( array $item ): string {
	if ( isset( $item['label'] ) && is_string( $item['label'] ) ) {
		return $item['label'];
	}
	if ( ! empty( $item['ariaLabel'] ) && is_string( $item['ariaLabel'] ) ) {
		return $item['ariaLabel'];
	}
	return '';
}